﻿using System;
using System.Collections.Generic;
using netDxf;
using netDxf.Entities;
using netDxf.Header;
using netDxf.Tables;


namespace TestDxfDocument
{
    class toolsystem
    {

        //邱阳
        public static void Converter(Dictionary<string, Object> data)  //切削工具系统-转换器
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            double pi = Math.PI;
            /*
            double l1 = 48; //Convert.ToDouble(data["l1"]);
            double oal = 110; //Convert.ToDouble(data["oal"]);
            double df = 60;  //Convert.ToDouble(data["df"]);
            double dm = 56;  //Convert.ToDouble(data["df"]);
            double lpr = 50;  //Convert.ToDouble(data["df"]);
            double lf = 35;  //Convert.ToDouble(data["df"]);
            double lpcon = 15;  //Convert.ToDouble(data["df"]);
            double dconws = 15;  //Convert.ToDouble(data["df"]);
            double bd = 45;  //Convert.ToDouble(data["df"]);
            double bted = 35;  //Convert.ToDouble(data["df"]);
            double lsc = 30;  //Convert.ToDouble(data["df"]);
            double crks = 13;  //Convert.ToDouble(data["df"]);
            double lb = 35;  //Convert.ToDouble(data["df"]);1
            double dcon = 32;  //Convert.ToDouble(data["df"]);
            double dl = 20;  //Convert.ToDouble(data["df"]);
            double x = 1;  //Convert.ToDouble(data["df"]);
            double xi = 2;  //Convert.ToDouble(data["df"]);
            double m = 12;  //Convert.ToDouble(data["df"]);
            double md = m * 0.85;
            double m2 = 10;  //Convert.ToDouble(data["df"]);
            double md2 = m2 * 0.85;
            double m3 = 10;  //Convert.ToDouble(data["df"]);
            double mp3 = 12;  //Convert.ToDouble(data["df"]);
            double md3 = m3 * 0.85;
            double ln1 = 8;  //Convert.ToDouble(data["df"]);
            double ln2 = 18;  //Convert.ToDouble(data["df"]);
            double ln3 = 6;  //Convert.ToDouble(data["df"]);
            double ln4 = 36;  //Convert.ToDouble(data["df"]);
            double ln5 = 3;  //Convert.ToDouble(data["df"]);
            double dn = 20;  //Convert.ToDouble(data["df"]);
            double bhta = pi / 6;  //Convert.ToDouble(data["df"]) * pi / 180;
            string path = "E:\\dxfp\\Converter.dxf"; // Convert.ToString(data["path"]);
            */
            double l1 = Convert.ToDouble(data["l1"]);
            double oal = Convert.ToDouble(data["oal"]);
            double df = Convert.ToDouble(data["df"]);
            double dm = Convert.ToDouble(data["dm"]);
            double lpr = Convert.ToDouble(data["lpr"]);
            double lf = Convert.ToDouble(data["lf"]);
            double lpcon = Convert.ToDouble(data["lpcon"]);
            double dconws = Convert.ToDouble(data["dconws"]);
            double bd = Convert.ToDouble(data["bd"]);
            double bted = Convert.ToDouble(data["bted"]);
            double lsc = Convert.ToDouble(data["lsc"]);
            double crks = 13;  //Convert.ToDouble(data["crks"]);
            double lb = 35;  //Convert.ToDouble(data["lb"]);
            double dcon = 32;  //Convert.ToDouble(data["dcon"]);
            double dl = 20;  //Convert.ToDouble(data["dl"]);
            double x = 1;  //Convert.ToDouble(data["x"]);
            double xi = 2;  //Convert.ToDouble(data["xi"]);
            double m = 12;  //Convert.ToDouble(data["m"]);
            double md = m * 0.85;
            double m2 = 10;  //Convert.ToDouble(data["m2"]);
            double md2 = m2 * 0.85;
            double m3 = 10;  //Convert.ToDouble(data["m3"]);
            double mp3 = 12;  //Convert.ToDouble(data["mp3"]);
            double md3 = m3 * 0.85;
            double ln1 = 8;  //Convert.ToDouble(data["ln1"]);
            double ln2 = 18;  //Convert.ToDouble(data["ln2"]);
            double ln3 = 6;  //Convert.ToDouble(data["ln3"]);
            double ln4 = 36;  //Convert.ToDouble(data["ln4"]);
            double ln5 = 3;  //Convert.ToDouble(data["ln5"]);
            double dn = 20;  //Convert.ToDouble(data["dn"]);
            double bhta = pi / 6;  //Convert.ToDouble(data["bhta"]) * pi / 180;
            string path = "E:\\dxfp\\Converter.dxf"; // Convert.ToString(data["path"]);

            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0p = new Vector2(p0.X + oal, p0.Y);
            Vector2 p1 = new Vector2(p0.X, p0.Y - crks / 2);
            Vector2 p2 = new Vector2(p0.X, p0.Y - dl / 2);
            Vector2 p3 = new Vector2(p2.X + l1, -dcon / 2);
            Vector2 p4 = fun.Polar(p3, 45, x);
            Vector2 p5 = new Vector2(p4.X + xi, p4.Y);
            Vector2 p6 = new Vector2(p5.X, -df / 2);
            Vector2 p7 = new Vector2(p6.X + lpcon / 3, p6.Y);
            Vector2 p8 = new Vector2(p7.X + (lpcon / 3 - xi) / 2, p7.Y + (df - dm) / 2);
            Vector2 p9 = new Vector2(p8.X + xi, p8.Y);
            Vector2 p10 = new Vector2(p7.X + lpcon / 3, p7.Y);
            Vector2 p11 = new Vector2(p10.X + lpcon / 3, p10.Y);
            Vector2 p12 = new Vector2(p11.X, -bd / 2);
            Vector2 p14 = new Vector2(p0p.X, p0p.Y - bted / 2);
            Vector2 p13 = new Vector2(p14.X - ((bd - bted) / 2) / Math.Tan(bhta), p14.Y - (bd - bted) / 2);
            Vector2 p15 = new Vector2(p12.X + (lf - lpcon - mp3 / 2), p12.Y);
            Vector2 p16 = new Vector2(p15.X, p15.Y + xi);
            Vector2 p17 = new Vector2(p16.X + mp3, p16.Y);
            Vector2 p18 = new Vector2(p17.X, p15.Y);




            //外轮廓镜像点坐标（非剖面部分）.
            Vector2 pm2 = new Vector2(p2.X, -p2.Y);
            Vector2 pm3 = new Vector2(p3.X, -p3.Y);
            Vector2 pm4 = new Vector2(p4.X, -p4.Y);
            Vector2 pm5 = new Vector2(p5.X, -p5.Y);
            Vector2 pm6 = new Vector2(p6.X, -p6.Y);
            Vector2 pm7 = new Vector2(p7.X, -p7.Y);
            Vector2 pm8 = new Vector2(p8.X, -p8.Y);
            Vector2 pm9 = new Vector2(p9.X, -p9.Y);
            Vector2 pm10 = new Vector2(p10.X, -p10.Y);
            Vector2 pm11 = new Vector2(p11.X, -p11.Y);
            Vector2 pm12 = new Vector2(p12.X, -p12.Y);
            Vector2 pm13 = new Vector2(p13.X, -p13.Y);
            Vector2 pm14 = new Vector2(p14.X, -p14.Y);

            LwPolyline poly1 = new LwPolyline(); //外轮廓
            poly1.Vertexes.Add(new LwPolylineVertex(p0));
            poly1.Vertexes.Add(new LwPolylineVertex(p2));
            poly1.Vertexes.Add(new LwPolylineVertex(p3));
            poly1.Vertexes.Add(new LwPolylineVertex(p4));
            poly1.Vertexes.Add(new LwPolylineVertex(p5));
            poly1.Vertexes.Add(new LwPolylineVertex(p6));
            poly1.Vertexes.Add(new LwPolylineVertex(p7));
            poly1.Vertexes.Add(new LwPolylineVertex(p8));
            poly1.Vertexes.Add(new LwPolylineVertex(p9));
            poly1.Vertexes.Add(new LwPolylineVertex(p10));
            poly1.Vertexes.Add(new LwPolylineVertex(p11));
            poly1.Vertexes.Add(new LwPolylineVertex(p12));
            poly1.Vertexes.Add(new LwPolylineVertex(p15));
            poly1.Vertexes.Add(new LwPolylineVertex(p16));
            poly1.Vertexes.Add(new LwPolylineVertex(p17));
            poly1.Vertexes.Add(new LwPolylineVertex(p18));
            poly1.Vertexes.Add(new LwPolylineVertex(p13));
            poly1.Vertexes.Add(new LwPolylineVertex(p14));
            poly1.Vertexes.Add(new LwPolylineVertex(p0p));
            poly1.Vertexes.Add(new LwPolylineVertex(pm14));
            poly1.Vertexes.Add(new LwPolylineVertex(pm13));
            poly1.Vertexes.Add(new LwPolylineVertex(pm12));
            poly1.Vertexes.Add(new LwPolylineVertex(pm11));
            poly1.Vertexes.Add(new LwPolylineVertex(pm10));
            poly1.Vertexes.Add(new LwPolylineVertex(pm9));
            poly1.Vertexes.Add(new LwPolylineVertex(pm8));
            poly1.Vertexes.Add(new LwPolylineVertex(pm7));
            poly1.Vertexes.Add(new LwPolylineVertex(pm6));
            poly1.Vertexes.Add(new LwPolylineVertex(pm5));
            poly1.Vertexes.Add(new LwPolylineVertex(pm4));
            poly1.Vertexes.Add(new LwPolylineVertex(pm3));
            poly1.Vertexes.Add(new LwPolylineVertex(pm2));
            poly1.Vertexes.Add(new LwPolylineVertex(p0));
            fun.PolyFill(dxf, poly1, 0.3, contour);

            Vector2[] cenline1 = { new Vector2(p0.X - 5, p0.Y), new Vector2(p0p.X + 5, p0p.Y) };//主轴中心线
            fun.drawPlinetype(dxf, cenline1, 0.15, centre, Linetype.Center);

            Vector2 pc3 = new Vector2(pm3.X, p0.Y); //上侧外轮廓投影于中心线的点
            Vector2 pc4 = new Vector2(pm4.X, p0.Y);
            Vector2 pc5 = new Vector2(pm5.X, p0.Y);
            Vector2 pc7 = new Vector2(pm7.X, p0.Y);
            Vector2 pc8 = new Vector2(pm8.X, p0.Y);
            Vector2 pc9 = new Vector2(pm9.X, p0.Y);
            Vector2 pc10 = new Vector2(pm10.X, p0.Y);
            Vector2 pc12 = new Vector2(pm12.X, p0.Y);
            Vector2 pc13 = new Vector2(pm13.X, p0.Y);

            Vector2[] line1 = { pm3, pc3 };
            fun.drawBLine(dxf, line1, 0.3, contour);
            Vector2[] line2 = { pm4, pc4 };
            fun.drawBLine(dxf, line2, 0.3, contour);
            Vector2[] line3 = { pm5, pc5 };
            fun.drawBLine(dxf, line3, 0.3, contour);
            Vector2[] line4 = { pm7, pc7 };
            fun.drawBLine(dxf, line4, 0.3, contour);
            Vector2[] line5 = { pm8, pc8 };
            fun.drawBLine(dxf, line5, 0.3, contour);
            Vector2[] line6 = { pm9, pc9 };
            fun.drawBLine(dxf, line6, 0.3, contour);
            Vector2[] line7 = { pm10, pc10 };
            fun.drawBLine(dxf, line7, 0.3, contour);
            Vector2[] line8 = { pm12, pc12 };
            fun.drawBLine(dxf, line8, 0.3, contour);
            Vector2[] line9 = { pm13, pc13 };
            fun.drawBLine(dxf, line9, 0.3, contour);

            Vector2 p19 = new Vector2(p1.X + ln1, p1.Y);//内轮廓点坐标
            Vector2 p20 = new Vector2(p19.X + x, -md / 2);
            Vector2 p21 = new Vector2(p20.X + ln2, p20.Y);
            Vector2 p22 = new Vector2(p21.X + ln3, p21.Y);
            Vector2 p23 = new Vector2(p22.X + x, -md2 / 2);
            Vector2 p24 = new Vector2(p23.X + ln4, p23.Y);
            Vector2 p25 = new Vector2(p24.X, -dn / 2);
            Vector2 p26 = new Vector2(p25.X + ln5, p25.Y);
            Vector2 p27 = new Vector2(p26.X, -dconws / 2);
            Vector2 p28 = new Vector2(p16.X + (mp3 - md3) / 2, p27.Y);
            Vector2 p29 = new Vector2(p28.X + md3, p28.Y);
            Vector2 p30 = new Vector2(p0p.X, p29.Y);
            Vector2 p31 = new Vector2(p28.X, p16.Y);
            Vector2 p32 = new Vector2(p29.X, p17.Y);

            Vector2 pc19 = new Vector2(p19.X, p0.Y);//内轮廓位于中心线的点
            Vector2 pc20 = new Vector2(p20.X, p0.Y);
            Vector2 pc21 = new Vector2(p21.X, p0.Y);
            Vector2 pc22 = new Vector2(p22.X, p0.Y);
            Vector2 pc23 = new Vector2(p23.X, p0.Y);
            Vector2 pc24 = new Vector2(p24.X, p0.Y);
            Vector2 pc27 = new Vector2(p27.X, p0.Y);


            LwPolyline polyn1 = new LwPolyline(); //内轮廓1
            polyn1.Vertexes.Add(new LwPolylineVertex(p1));
            polyn1.Vertexes.Add(new LwPolylineVertex(p19));
            polyn1.Vertexes.Add(new LwPolylineVertex(p20));
            polyn1.Vertexes.Add(new LwPolylineVertex(p21));
            polyn1.Vertexes.Add(new LwPolylineVertex(p22));
            polyn1.Vertexes.Add(new LwPolylineVertex(p23));
            polyn1.Vertexes.Add(new LwPolylineVertex(p24));
            polyn1.Vertexes.Add(new LwPolylineVertex(p25));
            polyn1.Vertexes.Add(new LwPolylineVertex(p26));
            polyn1.Vertexes.Add(new LwPolylineVertex(p27));
            polyn1.Vertexes.Add(new LwPolylineVertex(p28));
            polyn1.Vertexes.Add(new LwPolylineVertex(p31));
            fun.PolyFill(dxf, polyn1, 0.3, contour);

            LwPolyline polyn2 = new LwPolyline(); //内轮廓2
            polyn2.Vertexes.Add(new LwPolylineVertex(p32));
            polyn2.Vertexes.Add(new LwPolylineVertex(p29));
            polyn2.Vertexes.Add(new LwPolylineVertex(p30));
            fun.PolyFill(dxf, polyn2, 0.3, contour);

            //Vector2[] linep1 = { p1,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p31 };
            //fun.drawBLine(dxf, linep1, 0.3, contour);
            //Vector2[] linep2 = { p32, p29, p30 };
            //fun.drawBLine(dxf, linep2, 0.3, contour);
            Vector2[] linep3 = { p19, pc19 };
            fun.drawBLine(dxf, linep3, 0.3, contour);
            Vector2[] linep4 = { p20, pc20 };
            fun.drawBLine(dxf, linep4, 0.3, contour);
            Vector2[] linep5 = { p21, pc21 };
            fun.drawBLine(dxf, linep5, 0.3, contour);
            Vector2[] linep6 = { p22, pc22 };
            fun.drawBLine(dxf, linep6, 0.3, contour);
            Vector2[] linep7 = { p23, pc23 };
            fun.drawBLine(dxf, linep7, 0.3, contour);
            Vector2[] linep8 = { p24, pc24 };
            fun.drawBLine(dxf, linep8, 0.3, contour);
            Vector2[] linep9 = { p27, pc27 };
            fun.drawBLine(dxf, linep9, 0.3, contour);

            LwPolyline hatchpoly1 = new LwPolyline(); //填充第一区域
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p1));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p2));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p3));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p4));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p5));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p6));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p7));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p8));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p9));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p10));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p11));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p12));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p15));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p16));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p31));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p28));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p27));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p26));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p25));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p24));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p23));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p22));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p21));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p20));
            hatchpoly1.Vertexes.Add(new LwPolylineVertex(p19));
            hatchpoly1.IsClosed = true;
            String[] htype1 = new String[100];
            Line[] hline1 = new Line[100];
            int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst1; i++)
            {
                htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype1[i] == "Line")
                {
                    hline1[i] = (Line)hatchpoly1.Explode()[i];
                }
            }
            fun.hatchsubofline(dxf, htype1, hnumst1, 45, 12, hline1, hatching);

            LwPolyline hatchpoly2 = new LwPolyline(); //填充第二区域
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(p30));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(p29));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(p32));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(p17));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(p18));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(p13));
            hatchpoly2.Vertexes.Add(new LwPolylineVertex(p14));
            hatchpoly2.IsClosed = true;
            String[] htype2 = new String[100];
            Line[] hline2 = new Line[100];
            int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
            for (int i = 0; i < hnumst2; i++)
            {
                htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                if (htype2[i] == "Line")
                {
                    hline2[i] = (Line)hatchpoly2.Explode()[i];
                }
            }
            fun.hatchsubofline(dxf, htype2, hnumst2, 45, 12, hline2, hatching);

            Vector2 pcn1 = new Vector2((p15.X + p18.X) / 2, p15.Y - 5);
            Vector2 pcn2 = new Vector2((p15.X + p18.X) / 2, p28.Y + 5);
            Vector2 pcn3 = new Vector2(pcn2.X, pcn2.Y - 10);
            Vector2 pcn4 = new Vector2(pcn1.X, pcn1.Y - 5);

            Vector2[] cenline2 = { pcn1, pcn2 };//螺纹孔中心线
            fun.drawPlinetype(dxf, cenline2, 0.15, centre, Linetype.Center);
            /*
            Arc arc1 = fun.DrawArc(p29, pcn3, p28);//圆弧
            arc1.Layer = contour;
            dxf.AddEntity(arc1);
            Arc arc2 = fun.DrawArc(p18, pcn4, p15);
            arc2.Layer = contour;
            dxf.AddEntity(arc2);
            */
            LwPolyline poly2 = new LwPolyline(); //螺纹孔内圆弧
            poly2.Vertexes.Add(new LwPolylineVertex(p29));
            poly2.Vertexes[0].Bulge = Math.Tan(pi / 16);
            poly2.Vertexes.Add(new LwPolylineVertex(p28));
            fun.PolyFill(dxf, poly2, 0.3, contour);
            LwPolyline poly3 = new LwPolyline();//螺纹孔外圆弧
            poly3.Vertexes.Add(new LwPolylineVertex(p18));
            poly3.Vertexes[0].Bulge = Math.Tan(pi / 16);
            poly3.Vertexes.Add(new LwPolylineVertex(p15));
            fun.PolyFill(dxf, poly3, 0.3, contour);


            Vector2 px1 = new Vector2((p19.X + p20.X) / 2, (p19.Y + p20.Y) / 2); //螺纹线
            Vector2 px2 = new Vector2(p21.X, px1.Y);
            Vector2 px3 = new Vector2((p22.X + p23.X) / 2, (p22.Y + p23.Y) / 2);
            Vector2 px4 = new Vector2(p24.X, px3.Y);


            Vector2[] linex1 = { px1, px2, p21 };
            fun.drawPline(dxf, linex1, 0.15, contour);
            Vector2[] linex2 = { px3, px4 };
            fun.drawPline(dxf, linex2, 0.15, contour);
            Vector2[] linex3 = { new Vector2(p16.X + (mp3 - m3) / 2, p28.Y), new Vector2(p16.X + (mp3 - m3) / 2, p16.Y) };
            fun.drawPline(dxf, linex3, 0.15, contour);
            Vector2[] linex4 = { new Vector2(p17.X - (mp3 - m3) / 2, p28.Y), new Vector2(p17.X - (mp3 - m3) / 2, p16.Y) };
            fun.drawPline(dxf, linex4, 0.15, contour);

            //Vector2[] line = { p25, p26, p27, p24, p26 };
            //fun.drawPline(dxf, line3, contour);

            //主体尺寸标注：

            DimensionStyle dimensionStyle = fun.CreateDimStyle();
            dimensionStyle.ArrowSize = 0.2;
            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
            dimensionStyle.TextHeight = 0.5;
            double offset = 7;

            LinearDimension linedim1 = new LinearDimension(new Line(p2, p14), offset * 5, 180, dimensionStyle);//标注简化
            fun.dxflinedim(dxf, linedim1, oal);
            LinearDimension linedim2 = new LinearDimension(new Line(p11, pm11), offset * 12, 270, dimensionStyle);
            linedim2.UserText = String.Format("{0}", df);
            dxf.AddEntity(linedim2);
            LinearDimension linedim3 = new LinearDimension(new Line(p13, pm13), offset * 5, 270, dimensionStyle);
            linedim3.UserText = String.Format("{0}", bd);
            dxf.AddEntity(linedim3);


            Angular2LineDimension dimang1 = new Angular2LineDimension(new Line(pm13, fun.Polar(pm13, 0, 0.5)), new Line(fun.Polar(pm14, 2 * pi - bhta, 0.5), pm14), 3 * offset, dimensionStyle);
            //标注相关点坐标距离应尽量缩短 
            dimang1.SetDimensionLinePosition(fun.Polar(pm13, 2 * pi - bhta / 2, offset * 3));
            dimang1.UserText = String.Format("{0}°", bhta * 180 / pi);
            dxf.AddEntity(dimang1);
            /*
            Angular2LineDimension dimang1 = new Angular2LineDimension(new Line(pm13, fun.Polar(pm13, 0, 3.5 * offset)), new Line(fun.Polar(pm14, 2 * pi-bhta, 2 * offset), pm14), 3 * offset, dimensionStyle);
            dimang1.SetDimensionLinePosition(fun.Polar(pm13, 2 * pi-bhta / 2, offset * 3));
            dimang1.UserText = String.Format("{0}%%d", bhta * 180 / pi);
            dxf.AddEntity(dimang1);
            /*
            Vector2[] lined1 = { pm13, fun.Polar(pm13, 0, 3.5 * offset) };
            fun.drawPline(dxf, lined1, dimensioning);
            Vector2[] lined2 = { fun.Polar(pm14, 2 * pi - bhta, 2 * offset), pm14 };
            fun.drawPline(dxf, lined2, dimensioning);
            
            /*
            Angular2LineDimension dimang1 = new Angular2LineDimension(new Line(fun.Polar(p3, 0, offset / 10), p3), new Line(fun.Polar(p3, epsr, offset / 10), p3), offset / 3, ds);
            dimang1.SetDimensionLinePosition(fun.Polar(p3, epsr / 2, offset / 2));
            dimang1.UserText = String.Format("{0}%%d", epsr * 180 / pi);
            dxf.AddEntity(dimang1);

            Angular2LineDimension dimang2 = new Angular2LineDimension(new Line(new Vector2(150,100),new Vector2(100,100)), new Line(fun.Polar(new Vector2(100,100), pi/4, 50), new Vector2(100,100)), 50, dimensionStyle);
            dimang2.SetDimensionLinePosition(fun.Polar(new Vector2(100,100), pi / 8, 30));
            dimang2.UserText = String.Format("{0}%%d", (pi / 4) * 180 / pi);
            dxf.AddEntity(dimang2);
            */

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);

        }

        public static void ConverterStationaryB(Dictionary<string, Object> data) //切削工具系统-固定转换器
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            double pi = Math.PI;
            /*
            double oal = 64;
            double ls = 40;
            double lpr = 24;
            double lf = 12;
            double dcon = 20;
            double hf = 12;
            double h1 = 18;
            double h2 = 2;
            double l1 = 2;
            double l2 = 1;
            double l3 = 5; //右齿到右侧台阶距离
            double l4 = 6; //左齿到左端点距离
            double x1 = 2; //齿深
            double x2 = 1; //倒角长度
            double y1 = 3; //圆柱切除部分高度
            double oah = 42;
            double radh = 22;
            double h3 = 20;
            double rhcdl = 15;
            double rhcdu = 15;
            double oaw = 42;
            double radwof = 7;
            double radw = 23;
            double x3 = 3;
            double radhof = 2;
            double r1 = 1;
            double rhcau = 15 * pi / 180;
            double rhcal = 15 * pi / 180;
            string path = "E:\\dxfp\\ConverterStationary.dxf";
            */
            double oal = Convert.ToDouble(data["oal"]);
            double ls = Convert.ToDouble(data["ls"]);
            double lpr = Convert.ToDouble(data["lpr"]);
            double lf = Convert.ToDouble(data["lf"]);
            double dcon = Convert.ToDouble(data["dcon"]);
            double hf = Convert.ToDouble(data["hf"]);
            double h1 = Convert.ToDouble(data["h1"]);
            double h2 = Convert.ToDouble(data["h2"]);
            double l1 = Convert.ToDouble(data["l1"]);
            double l2 = Convert.ToDouble(data["l2"]);
            double l3 = Convert.ToDouble(data["l3"]); //右齿到右侧台阶距离
            double l4 = Convert.ToDouble(data["l4"]); //左齿到左端点距离
            double x1 = Convert.ToDouble(data["x1"]); //齿深
            double x2 = Convert.ToDouble(data["x2"]); //倒角长度
            double y1 = Convert.ToDouble(data["y1"]); //圆柱切除部分高度
            double oah = Convert.ToDouble(data["oah"]);
            double radh = Convert.ToDouble(data["radh"]);
            double h3 = Convert.ToDouble(data["h3"]);
            double rhcdl = Convert.ToDouble(data["rhcdl"]);
            double rhcdu = Convert.ToDouble(data["rhcdu"]);
            double oaw = Convert.ToDouble(data["oaw"]);
            double radwof = Convert.ToDouble(data["radwof"]);
            double radw = Convert.ToDouble(data["radw"]);
            double x3 = Convert.ToDouble(data["x3"]);
            double radhof = Convert.ToDouble(data["radhof"]);
            double r1 = Convert.ToDouble(data["r1"]);
            double rhcau = Convert.ToDouble(data["rhcau"]) * pi / 180;
            double rhcal = Convert.ToDouble(data["rhcal"]) * pi / 180;
            string path = Convert.ToString(data["path"]);

            Vector2 p0 = new Vector2(0, 0);           //左视图
            Vector2 p1 = new Vector2(p0.X, p0.Y + (h1 - hf));
            Vector2 p2 = new Vector2(p0.X, p0.Y + rhcdu);
            Vector2 p3 = new Vector2(p2.X + (h3 - rhcdu) / Math.Tan(rhcau), p0.Y + h3);
            Vector2 p4 = new Vector2(p0.X + oaw - radwof, p3.Y);
            Vector2 p5 = new Vector2(p4.X, p1.Y);
            Vector2 p6 = new Vector2(p5.X, p0.Y - radhof);
            Vector2 p7 = new Vector2(p6.X + radwof, p6.Y);
            Vector2 p8 = new Vector2(p7.X, p0.Y - hf);
            Vector2 p9 = new Vector2(p8.X, p0.Y - radh + r1);
            Vector2 p10 = new Vector2(p9.X - r1, p9.Y - r1);
            Vector2 p11 = new Vector2((radh - rhcdl) / Math.Tan(rhcal), p10.Y);
            Vector2 p12 = new Vector2(p0.X, p0.Y - rhcdl);
            Vector2 p13 = new Vector2(p0.X, p0.Y - hf);

            Vector2 pn1 = new Vector2(p0.X + x3, p0.Y);
            Vector2 pn2 = new Vector2(pn1.X, pn1.Y + (h1 - hf - h2));
            Vector2 pn3 = new Vector2(p5.X - x3, pn2.Y);
            Vector2 pn4 = new Vector2(pn3.X, pn1.Y);


            LwPolyline poly1 = new LwPolyline(); //left contour
            poly1.Vertexes.Add(new LwPolylineVertex(p0));
            poly1.Vertexes.Add(new LwPolylineVertex(p13));
            poly1.Vertexes.Add(new LwPolylineVertex(p12));
            poly1.Vertexes.Add(new LwPolylineVertex(p11));
            poly1.Vertexes.Add(new LwPolylineVertex(p10));
            poly1.Vertexes[4].Bulge = Math.Tan(pi / 8);
            poly1.Vertexes.Add(new LwPolylineVertex(p9));
            poly1.Vertexes.Add(new LwPolylineVertex(p8));
            poly1.Vertexes.Add(new LwPolylineVertex(p7));
            poly1.Vertexes.Add(new LwPolylineVertex(p6));
            poly1.Vertexes.Add(new LwPolylineVertex(p5));
            poly1.Vertexes.Add(new LwPolylineVertex(p4));
            poly1.Vertexes.Add(new LwPolylineVertex(p3));
            poly1.Vertexes.Add(new LwPolylineVertex(p2));
            poly1.Vertexes.Add(new LwPolylineVertex(p1));
            poly1.Vertexes.Add(new LwPolylineVertex(p0));
            fun.PolyFill(dxf, poly1, 0.3, contour);

            LwPolyline polyn1 = new LwPolyline();
            polyn1.Vertexes.Add(new LwPolylineVertex(pn1));
            polyn1.Vertexes.Add(new LwPolylineVertex(pn2));
            polyn1.Vertexes.Add(new LwPolylineVertex(pn3));
            polyn1.Vertexes.Add(new LwPolylineVertex(pn4));
            polyn1.Vertexes.Add(new LwPolylineVertex(pn1));
            fun.PolyFill(dxf, polyn1, 0.3, contour);

            Vector2[] linel1 = { p1, p5 };
            fun.drawBLine(dxf, linel1, 0.3, contour);
            Vector2[] linel2 = { p13, p8 };
            fun.drawBLine(dxf, linel2, 0.3, contour);

            Vector2 pc0 = new Vector2(p7.X - radw, p0.Y);

            Circle circle1 = new Circle(pc0, dcon / 2);
            circle1.Linetype = Linetype.DashDot;
            dxf.AddEntity(circle1);

            Vector2 p14 = new Vector2(p0.X + 1.5 * oaw, p0.Y);//主视图
            Vector2 p15 = new Vector2(p14.X, p14.Y - dcon / 2 + x2);
            Vector2 p16 = new Vector2(p15.X + x2, p15.Y - x2);
            Vector2 p17 = new Vector2(p15.X + ls, p16.Y);
            Vector2 p18 = new Vector2(p17.X, p12.Y);
            Vector2 p19 = new Vector2(p18.X, p11.Y);
            Vector2 p20 = new Vector2(p19.X + lpr, p19.Y);
            Vector2 p21 = new Vector2(p20.X, p18.Y);
            Vector2 p22 = new Vector2(p21.X, p8.Y);
            Vector2 p23 = new Vector2(p17.X + lf, p22.Y);
            Vector2 p24 = new Vector2(p23.X, p5.Y);
            Vector2 p25 = new Vector2(p22.X, p24.Y);
            Vector2 p26 = new Vector2(p25.X, p2.Y);
            Vector2 p27 = new Vector2(p26.X, p3.Y);
            Vector2 p28 = new Vector2(p17.X, p27.Y);
            Vector2 p29 = new Vector2(p28.X, p26.Y);
            Vector2 p30 = new Vector2(p29.X, p0.Y + dcon / 2);
            Vector2 p31 = new Vector2(p30.X - l2, p30.Y);
            Vector2 p32 = new Vector2(p31.X, p31.Y - y1);
            Vector2 p33 = new Vector2(p32.X - l3, p32.Y);
            Vector2 p34 = new Vector2(p33.X - 2 * 7 * x1, p33.Y);
            Vector2 p35 = new Vector2(p16.X, p34.Y);
            Vector2 p36 = new Vector2(p14.X, p35.Y);

            Vector2 pz1 = new Vector2(p34.X + x1, p34.Y - x1);
            Vector2 pz2 = new Vector2(p34.X + 2 * x1, p34.Y);
            Vector2 pz3 = new Vector2(pz2.X + x1, pz2.Y - x1);
            Vector2 pz4 = new Vector2(pz2.X + 2 * x1, pz2.Y);
            Vector2 pz5 = new Vector2(pz4.X + x1, pz4.Y - x1);
            Vector2 pz6 = new Vector2(pz4.X + 2 * x1, pz4.Y);
            Vector2 pz7 = new Vector2(pz6.X + x1, pz5.Y);
            Vector2 pz8 = new Vector2(pz6.X + 2 * x1, pz6.Y);
            Vector2 pz9 = new Vector2(pz8.X + x1, pz7.Y);
            Vector2 pz10 = new Vector2(pz8.X + 2 * x1, pz8.Y);
            Vector2 pz11 = new Vector2(pz10.X + x1, pz9.Y);
            Vector2 pz12 = new Vector2(pz10.X + 2 * x1, pz10.Y);
            Vector2 pz13 = new Vector2(pz12.X + x1, pz11.Y);


            LwPolyline poly2 = new LwPolyline(); //right contour
            poly2.Vertexes.Add(new LwPolylineVertex(p14));
            poly2.Vertexes.Add(new LwPolylineVertex(p15));
            poly2.Vertexes.Add(new LwPolylineVertex(p16));
            poly2.Vertexes.Add(new LwPolylineVertex(p17));
            poly2.Vertexes.Add(new LwPolylineVertex(p18));
            poly2.Vertexes.Add(new LwPolylineVertex(p19));
            poly2.Vertexes.Add(new LwPolylineVertex(p20));
            poly2.Vertexes.Add(new LwPolylineVertex(p21));
            poly2.Vertexes.Add(new LwPolylineVertex(p22));
            poly2.Vertexes.Add(new LwPolylineVertex(p23));
            poly2.Vertexes.Add(new LwPolylineVertex(p24));
            poly2.Vertexes.Add(new LwPolylineVertex(p25));
            poly2.Vertexes.Add(new LwPolylineVertex(p26));
            poly2.Vertexes.Add(new LwPolylineVertex(p27));
            poly2.Vertexes.Add(new LwPolylineVertex(p28));
            poly2.Vertexes.Add(new LwPolylineVertex(p29));
            poly2.Vertexes.Add(new LwPolylineVertex(p30));
            poly2.Vertexes.Add(new LwPolylineVertex(p31));
            poly2.Vertexes.Add(new LwPolylineVertex(p32));
            poly2.Vertexes.Add(new LwPolylineVertex(p33));
            poly2.Vertexes.Add(new LwPolylineVertex(pz13));
            poly2.Vertexes.Add(new LwPolylineVertex(pz12));
            poly2.Vertexes.Add(new LwPolylineVertex(pz11));
            poly2.Vertexes.Add(new LwPolylineVertex(pz10));
            poly2.Vertexes.Add(new LwPolylineVertex(pz9));
            poly2.Vertexes.Add(new LwPolylineVertex(pz8));
            poly2.Vertexes.Add(new LwPolylineVertex(pz7));
            poly2.Vertexes.Add(new LwPolylineVertex(pz6));
            poly2.Vertexes.Add(new LwPolylineVertex(pz5));
            poly2.Vertexes.Add(new LwPolylineVertex(pz4));
            poly2.Vertexes.Add(new LwPolylineVertex(pz3));
            poly2.Vertexes.Add(new LwPolylineVertex(pz2));
            poly2.Vertexes.Add(new LwPolylineVertex(pz1));
            poly2.Vertexes.Add(new LwPolylineVertex(p34));
            poly2.Vertexes.Add(new LwPolylineVertex(p35));
            poly2.Vertexes.Add(new LwPolylineVertex(p36));
            poly2.Vertexes.Add(new LwPolylineVertex(p14));
            fun.PolyFill(dxf, poly2, 0.3, contour);

            Vector2[] cenline1 = { new Vector2(p0.X - 2, p0.Y), new Vector2(p27.X + 2, p0.Y) };//主轴中心线
            fun.drawPlinetype(dxf, cenline1, 0.15, centre, Linetype.Center);
            Vector2[] cenline2 = { new Vector2(pc0.X, pc0.Y + dcon + 2), new Vector2(pc0.X, p0.Y - dcon - 2) };//圆柱中心线
            fun.drawPlinetype(dxf, cenline2, 0.15, centre, Linetype.Center);

            Vector2 pn5 = new Vector2(p24.X + l1, p14.Y);
            Vector2 pn6 = new Vector2(pn5.X, p24.Y - h2);
            Vector2 pn7 = new Vector2(p25.X, pn6.Y);
            Vector2 pn8 = new Vector2(pn7.X, pn5.Y);

            LwPolyline polyn2 = new LwPolyline();
            polyn2.Vertexes.Add(new LwPolylineVertex(pn5));
            polyn2.Vertexes.Add(new LwPolylineVertex(pn6));
            polyn2.Vertexes.Add(new LwPolylineVertex(pn7));
            polyn2.Vertexes.Add(new LwPolylineVertex(pn8));
            polyn2.Vertexes.Add(new LwPolylineVertex(pn5));
            fun.PolyFill(dxf, polyn2, 0.3, contour);

            Vector2[] liner1 = { p16, p35 };
            fun.drawBLine(dxf, liner1, 0.3, contour);
            Vector2[] liner2 = { p30, p17 };
            fun.drawBLine(dxf, liner2, 0.3, contour);
            Vector2[] liner3 = { p26, p29 };
            fun.drawBLine(dxf, liner3, 0.3, contour);
            Vector2[] liner4 = { p18, p21 };
            fun.drawBLine(dxf, liner4, 0.3, contour);


            DimensionStyle dimensionStyle = fun.CreateDimStyle();
            dimensionStyle.ArrowSize = 0.2;
            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
            dimensionStyle.TextHeight = 0.5;
            double offset = 7;

            LinearDimension linedim1 = new LinearDimension(new Line(p12, p9), offset * 2, 180, dimensionStyle);
            linedim1.UserText = String.Format("{0}", oaw);
            dxf.AddEntity(linedim1);
            LinearDimension linedim2 = new LinearDimension(new Line(p3, p11), offset * 5, 90, dimensionStyle);
            linedim2.UserText = String.Format("{0}", oah);
            dxf.AddEntity(linedim2);
            LinearDimension linedim3 = new LinearDimension(new Line(p36, p27), offset * 2, 0, dimensionStyle);
            linedim3.UserText = String.Format("{0}", oal);
            dxf.AddEntity(linedim3);
            LinearDimension linedim4 = new LinearDimension(new Line(p31, p16), offset * 3, 90, dimensionStyle);
            linedim3.UserText = String.Format("{0}", dcon);
            dxf.AddEntity(linedim4);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }

        public static void Extender1(Dictionary<string, Object> data)  //延长器
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            double pi = Math.PI;

            double oal = 72;
            double lpr = 50;
            double lpcon = 16;
            double lb = 34;
            double dcon = 20;
            double dconws = 32;
            double l1 = 6;
            double lc = 8;
            double l2 = 2;
            double h1 = 4;//切槽宽度
            double dc1 = 20;//内孔直径
            double lc1 = 22;//内孔深度
            double dj = 1;
            string path = "E:\\dxfp\\Extender.dxf";
            /*
            double oal = Convert.ToDouble(data["oal"]);
            double lpr = Convert.ToDouble(data["lpr"]);
            double lpcon = Convert.ToDouble(data["lpcon"]);
            double lb = Convert.ToDouble(data["lb"]);
            double dcon = Convert.ToDouble(data["dcon"]);
            double dconws = Convert.ToDouble(data["dconws"]);
            double l1 = Convert.ToDouble(data["l1"]);
            double lc = Convert.ToDouble(data["lc"]);
            double l2 = Convert.ToDouble(data["l2"]);
            double h1 = Convert.ToDouble(data["h1"]);//切槽宽度
            double dc1 = Convert.ToDouble(data["dc1"]);//内孔直径
            double lc1 = Convert.ToDouble(data["lc1"]);//内孔深度
            double dj = Convert.ToDouble(data["dj"]);
            string path = Convert.ToDouble(data["path"]);
            */
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0p = new Vector2(p0.X + oal, p0.Y);
            Vector2 p1 = new Vector2(p0.X, p0.Y - dcon / 2 + dj);
            Vector2 p2 = new Vector2(p1.X + dj, p1.Y - dj);
            Vector2 p3 = new Vector2(p0.X + (oal - lpr), p2.Y);
            Vector2 p4 = new Vector2(p3.X, p0.Y - dconws / 2);
            Vector2 p5 = new Vector2(p4.X + lpcon, p4.Y);
            Vector2 p6 = new Vector2(p5.X + lb, p5.Y);
            Vector2 p7 = new Vector2(p0p.X, p0p.Y - dc1 / 2);
            Vector2 p8 = new Vector2(p7.X, p7.Y + dc1);
            Vector2 p9 = new Vector2(p6.X, -p6.Y);
            Vector2 p10 = new Vector2(p5.X, -p5.Y);
            Vector2 p11 = new Vector2(p4.X, -p4.Y);
            Vector2 p12 = new Vector2(p3.X, -p3.Y);
            Vector2 p13 = new Vector2(p2.X, -p2.Y);
            Vector2 p14 = new Vector2(p1.X, -p1.Y);

            Vector2[] cenline1 = { new Vector2(p0.X - 2, p0.Y), new Vector2(p0p.X + 2, p0.Y) };//主轴中心线
            fun.drawPlinetype(dxf, cenline1, 0.15, centre, Linetype.Center);
            Vector2[] cenline2 = { new Vector2((p4.X + p5.X) / 2, p4.Y - 2), new Vector2((p4.X + p5.X) / 2, p11.Y + 2) };//圆柱中心线
            fun.drawPlinetype(dxf, cenline2, 0.15, centre, Linetype.Center);

            LwPolyline poly1 = new LwPolyline(); //right contour
            poly1.Vertexes.Add(new LwPolylineVertex(p0));
            poly1.Vertexes.Add(new LwPolylineVertex(p1));
            poly1.Vertexes.Add(new LwPolylineVertex(p2));
            poly1.Vertexes.Add(new LwPolylineVertex(p3));
            poly1.Vertexes.Add(new LwPolylineVertex(p4));
            poly1.Vertexes.Add(new LwPolylineVertex(p5));
            poly1.Vertexes.Add(new LwPolylineVertex(p6));
            poly1.Vertexes.Add(new LwPolylineVertex(p7));
            poly1.Vertexes.Add(new LwPolylineVertex(p8));
            poly1.Vertexes.Add(new LwPolylineVertex(p9));
            poly1.Vertexes.Add(new LwPolylineVertex(p10));
            poly1.Vertexes.Add(new LwPolylineVertex(p11));
            poly1.Vertexes.Add(new LwPolylineVertex(p12));
            poly1.Vertexes.Add(new LwPolylineVertex(p13));
            poly1.Vertexes.Add(new LwPolylineVertex(p14));
            poly1.Vertexes.Add(new LwPolylineVertex(p0));
            fun.PolyFill(dxf, poly1, 0.3, contour);

            Vector2[] line1 = { p2, p13 };
            fun.drawBLine(dxf, line1, 0.3, contour);
            Vector2[] line2 = { p3, p12 };
            fun.drawBLine(dxf, line2, 0.3, contour);
            Vector2[] line3 = { p5, p10 };
            fun.drawBLine(dxf, line3, 0.3, contour);

            Vector2 pn1 = new Vector2((p4.X + p5.X) / 2 - h1 / 2, p0.Y - l1);
            Vector2 pn2 = new Vector2(pn1.X, pn1.Y - lc);
            Vector2 pn3 = new Vector2(pn2.X + h1, pn2.Y);
            Vector2 pn4 = new Vector2(pn3.X, pn1.Y);
            Vector2 pn5 = new Vector2(pn1.X, -pn1.Y);
            Vector2 pn6 = new Vector2(pn2.X, -pn2.Y);
            Vector2 pn7 = new Vector2(pn3.X, -pn3.Y);
            Vector2 pn8 = new Vector2(pn4.X, -pn4.Y);
            Vector2 pl1 = new Vector2(p7.X - lc1, p7.Y);
            Vector2 pl2 = new Vector2(pl1.X, p8.Y);

            Vector2[] linec1 = { p7, pl1, pl2, p8 };//内轮廓（虚线）
            fun.drawPlinetype(dxf, linec1, 0.15, contour, Linetype.Dashed);
            //Vector2[] linec1 = { p7, pl1, pl2, p8 };//孔内轮廓
            //fun.drawBLine(dxf, linec1, 0.3, refin);

            Vector2[] linecn1 = { pn1, pn2 };
            fun.drawBLine(dxf, linecn1, 0.3, contour);
            Vector2[] linecn2 = { pn3, pn4 };
            fun.drawBLine(dxf, linecn2, 0.3, contour);
            Vector2[] linecn3 = { pn5, pn6 };
            fun.drawBLine(dxf, linecn3, 0.3, contour);
            Vector2[] linecn4 = { pn7, pn8 };
            fun.drawBLine(dxf, linecn4, 0.3, contour);

            LwPolyline poly2 = new LwPolyline(); //上切槽
            poly2.Vertexes[0].Bulge = Math.Tan(pi / 16);
            poly2.Vertexes.Add(new LwPolylineVertex(pn2));
            poly2.Vertexes.Add(new LwPolylineVertex(pn3));
            poly2.Vertexes[2].Bulge = Math.Tan(pi / 16);
            poly2.Vertexes.Add(new LwPolylineVertex(pn4));
            poly2.Vertexes.Add(new LwPolylineVertex(pn1));
            fun.PolyFill(dxf, poly2, 0.3, contour);

            LwPolyline poly3 = new LwPolyline(); //下切槽
            poly3.Vertexes.Add(new LwPolylineVertex(pn6));
            poly3.Vertexes[0].Bulge = Math.Tan(pi / 16);
            poly3.Vertexes.Add(new LwPolylineVertex(pn5));
            poly3.Vertexes.Add(new LwPolylineVertex(pn8));
            poly3.Vertexes[2].Bulge = Math.Tan(pi / 16);
            poly3.Vertexes.Add(new LwPolylineVertex(pn7));
            poly3.Vertexes.Add(new LwPolylineVertex(pn6));
            fun.PolyFill(dxf, poly3, 0.3, contour);

            DimensionStyle dimensionStyle = fun.CreateDimStyle();//标注
            dimensionStyle.ArrowSize = 0.2;
            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
            dimensionStyle.TextHeight = 0.5;
            double offset = 7;

            LinearDimension linedim1 = new LinearDimension(new Line(p11, p9), offset, 0, dimensionStyle);
            linedim1.UserText = String.Format("{0}", lpr);
            dxf.AddEntity(linedim1);
            LinearDimension linedim2 = new LinearDimension(new Line(p1, p6), offset * 2, 180, dimensionStyle);
            linedim2.UserText = String.Format("{0}", oal);
            dxf.AddEntity(linedim2);
            LinearDimension linedim3 = new LinearDimension(new Line(p13, p2), offset, 90, dimensionStyle);
            linedim3.UserText = String.Format("{0}", dcon);
            dxf.AddEntity(linedim3);
            LinearDimension linedim4 = new LinearDimension(new Line(p6, p9), offset, 270, dimensionStyle);
            linedim4.UserText = String.Format("{0}", lpr);
            dxf.AddEntity(linedim4);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }

        public static void Reducer(Dictionary<string, Object> data)  //变径器
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            double pi = Math.PI;

            double oal = 100;
            double lpr = 84;
            double lb1 = 38;
            double lb2 = 28;
            double lpcon = 18;
            double lbd = 22;
            double bd1 = 45;
            double bd2 = 20;
            double dc1 = 18;
            double dcon = 30;
            double dm = 6;
            double l1 = 3;
            double l2 = 2;
            double l3 = 10;
            double l4 = 1;
            double l5 = 3;
            double r1 = 2;
            double r2 = 5;
            double lc1 = 11;
            double lr = 10;
            double h1 = 4;
            double h2 = 3;
            double x1 = 0.5;//倒角
            double x2 = 5;//切口下边长
            double ang1 = 5 * pi / 180;
            double ang2 = 45 * pi / 180;
            double lx1 = 16;
            double lx2 = 6;
            double lx3 = 6;
            double dx1 = 30;
            double dx2 = 18;
            double dx3 = 16;
            string path = "E:\\dxfp\\Reducer.dxf";
            /*
            double oal = Convert.ToDouble(data["oal"]);
            double lpr = Convert.ToDouble(data["lpr"]);
            double lb1 = Convert.ToDouble(data["lb1"]);
            double lb2 = Convert.ToDouble(data["lb2"]);
            double lpcon = Convert.ToDouble(data["lpcon"]);
            double lbd = Convert.ToDouble(data["lbd"]);
            double bd1 = Convert.ToDouble(data["bd1"]);
            double bd2 = Convert.ToDouble(data["bd2"]);
            double dc1 = Convert.ToDouble(data["dc1"]);
            double dcon = Convert.ToDouble(data["dcon"]);
            double dm = Convert.ToDouble(data["dm"]);
            double l1 = Convert.ToDouble(data["l1"]);
            double l2 = Convert.ToDouble(data["l2"]);
            double l3 = Convert.ToDouble(data["l3"]);
            double l4 = Convert.ToDouble(data["l4"]);
            double l5 = Convert.ToDouble(data["l5"]);
            double r1 = Convert.ToDouble(data["r1"]);
            double r2 = Convert.ToDouble(data["r2"]);
            double lc1 = Convert.ToDouble(data["lc1"]);
            double lr = Convert.ToDouble(data["lr"]);
            double h1 = Convert.ToDouble(data["h1"]);
            double h2 = Convert.ToDouble(data["h2"]);
            double x1 = Convert.ToDouble(data["x1"]);//倒角
            double x2 = Convert.ToDouble(data["x2"]);//切口下边长
            double ang1 = Convert.ToDouble(data["ang1"]);
            double ang2 = Convert.ToDouble(data["ang2"]);
            double lx1 = Convert.ToDouble(data["lx1"]);
            double lx2 = Convert.ToDouble(data["lx2"]);
            double lx3 = Convert.ToDouble(data["lx3"]);
            double dx1 = Convert.ToDouble(data["dx1"]);
            double dx2 = Convert.ToDouble(data["dx2"]);
            double dx3 = Convert.ToDouble(data["dx3"]);
            string path = Convert.ToDouble(data["path"]);
            */
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0p = new Vector2(p0.X + oal, p0.Y);
            Vector2 p1 = new Vector2(p0.X + l1 + l2, p0.Y);
            Vector2 p2 = new Vector2(p1.X, p1.Y - dm / 2);
            Vector2 p3 = new Vector2(p0.X + l1, p2.Y);
            Vector2 p4 = new Vector2(p0.X + x1, p3.Y);
            Vector2 p5 = new Vector2(p0.X, p4.Y - x1);
            Vector2 p6 = new Vector2(p0.X, p0.Y - dc1 / 2);
            Vector2 p7 = new Vector2(p0.X + (oal - lpr), p0.Y - dc1 / 2 - (oal - lpr) * Math.Tan(ang1));
            Vector2 p8 = new Vector2(p7.X, p0.Y - dcon / 2);
            Vector2 p9 = new Vector2(p8.X + l3, p8.Y);
            Vector2 p10 = new Vector2(p8.X + lpcon, p8.Y);
            Vector2 p11 = new Vector2(p10.X - l5, p10.Y);
            Vector2 p12 = fun.Polar(p9, ang2, l4);
            Vector2 p13 = fun.Polar(p11, pi - ang2, l4);
            Vector2 p14 = new Vector2(p10.X, p0.Y - bd2 / 2);
            Vector2 p15 = new Vector2(p14.X + lbd, p14.Y);
            Vector2 p16 = new Vector2(p14.X + lb2, p0.Y - bd1 / 2);
            Vector2 p17 = new Vector2(p16.X + lb1, p16.Y);
            Vector2 p18 = new Vector2(p12.X, p12.Y + x1);
            Vector2 p19 = new Vector2(p13.X, p13.Y + x1);
            Vector2 pm2 = new Vector2(p2.X, -p2.Y);
            Vector2 pm3 = new Vector2(p3.X, -p3.Y);
            Vector2 pm4 = new Vector2(p4.X, -p4.Y);
            Vector2 pm5 = new Vector2(p5.X, -p5.Y);
            Vector2 pm6 = new Vector2(p6.X, -p6.Y);
            Vector2 pm7 = new Vector2(p7.X, -p7.Y);
            Vector2 pm8 = new Vector2(p8.X, -p8.Y);
            Vector2 pm9 = new Vector2(p9.X, -p9.Y);
            Vector2 pm10 = new Vector2(p10.X, -p10.Y);
            Vector2 pm11 = new Vector2(p11.X, -p11.Y);
            Vector2 pm12 = new Vector2(p12.X, -p12.Y);
            Vector2 pm13 = new Vector2(p13.X, -p13.Y);
            Vector2 pm14 = new Vector2(p14.X, -p14.Y);
            Vector2 pm15 = new Vector2(p15.X, -p15.Y);
            Vector2 pm16 = new Vector2(p16.X, -p16.Y);
            Vector2 pm17 = new Vector2(p17.X, -p17.Y);
            Vector2 pm18 = new Vector2(p18.X, -p18.Y);
            Vector2 pm19 = new Vector2(p19.X, -p19.Y);

            LwPolyline poly1 = new LwPolyline(); //right contour
            poly1.Vertexes.Add(new LwPolylineVertex(p1));
            poly1.Vertexes.Add(new LwPolylineVertex(p2));
            poly1.Vertexes.Add(new LwPolylineVertex(p3));
            poly1.Vertexes.Add(new LwPolylineVertex(p4));
            poly1.Vertexes.Add(new LwPolylineVertex(p5));
            poly1.Vertexes.Add(new LwPolylineVertex(p6));
            poly1.Vertexes.Add(new LwPolylineVertex(p7));
            poly1.Vertexes.Add(new LwPolylineVertex(p8));
            poly1.Vertexes.Add(new LwPolylineVertex(p9));
            poly1.Vertexes.Add(new LwPolylineVertex(p12));
            poly1.Vertexes.Add(new LwPolylineVertex(p18));
            poly1.Vertexes.Add(new LwPolylineVertex(p19));
            poly1.Vertexes.Add(new LwPolylineVertex(p13));
            poly1.Vertexes.Add(new LwPolylineVertex(p11));
            poly1.Vertexes.Add(new LwPolylineVertex(p10));
            poly1.Vertexes.Add(new LwPolylineVertex(p14));
            poly1.Vertexes.Add(new LwPolylineVertex(p15));
            poly1.Vertexes.Add(new LwPolylineVertex(p16));
            poly1.Vertexes.Add(new LwPolylineVertex(p17));
            poly1.Vertexes.Add(new LwPolylineVertex(pm17));
            poly1.Vertexes.Add(new LwPolylineVertex(pm16));
            poly1.Vertexes.Add(new LwPolylineVertex(pm15));
            poly1.Vertexes.Add(new LwPolylineVertex(pm14));
            poly1.Vertexes.Add(new LwPolylineVertex(pm10));
            poly1.Vertexes.Add(new LwPolylineVertex(pm11));
            poly1.Vertexes.Add(new LwPolylineVertex(pm13));
            poly1.Vertexes.Add(new LwPolylineVertex(pm19));
            poly1.Vertexes.Add(new LwPolylineVertex(pm18));
            poly1.Vertexes.Add(new LwPolylineVertex(pm12));
            poly1.Vertexes.Add(new LwPolylineVertex(pm9));
            poly1.Vertexes.Add(new LwPolylineVertex(pm8));
            poly1.Vertexes.Add(new LwPolylineVertex(pm7));
            poly1.Vertexes.Add(new LwPolylineVertex(pm6));
            poly1.Vertexes.Add(new LwPolylineVertex(pm5));
            poly1.Vertexes.Add(new LwPolylineVertex(pm4));
            poly1.Vertexes.Add(new LwPolylineVertex(pm3));
            poly1.Vertexes.Add(new LwPolylineVertex(pm2));
            poly1.Vertexes.Add(new LwPolylineVertex(p1));
            fun.PolyFill(dxf, poly1, 0.3, contour);

            Vector2[] line1 = { p3, pm3 };
            fun.drawBLine(dxf, line1, 0.3, contour);
            Vector2[] line2 = { p7, pm7 };
            fun.drawBLine(dxf, line2, 0.3, contour);
            Vector2[] line3 = { p14, pm14 };
            fun.drawBLine(dxf, line3, 0.3, contour);
            Vector2[] line4 = { p15, pm15 };
            fun.drawBLine(dxf, line4, 0.3, contour);
            Vector2[] line5 = { p16, pm16 };
            fun.drawBLine(dxf, line5, 0.3, contour);

            Vector2 pc0 = new Vector2(p0.X + lc1, p0.Y);
            Vector2 pc1 = new Vector2(p10.X - lr, p0.Y);
            Vector2 pn1 = new Vector2(p10.X, p0.Y - r2);
            Vector2 pn2 = new Vector2(p11.X, pn1.Y);
            Vector2 pn3 = new Vector2(p13.X, pn1.Y);
            Vector2 pn4 = new Vector2(p12.X, pn1.Y);
            Vector2 pn5 = new Vector2(p9.X, pn1.Y);
            Vector2 pn6 = new Vector2(pc1.X, pn1.Y);
            Vector2 pn7 = new Vector2(pn6.X, -pn6.Y);
            Vector2 pn8 = new Vector2(pn5.X, -pn5.Y);
            Vector2 pn9 = new Vector2(pn4.X, -pn4.Y);
            Vector2 pn10 = new Vector2(pn3.X, -pn3.Y);
            Vector2 pn11 = new Vector2(pn2.X, -pn2.Y);
            Vector2 pn12 = new Vector2(pn1.X, -pn1.Y);
            Vector2 pk1 = new Vector2(pn5.X, pn5.Y - h1);
            Vector2 pk2 = new Vector2(pn4.X, pk1.Y);
            Vector2 pk3 = new Vector2(pn4.X - x2, pk1.Y - h2);
            Vector2 pk4 = new Vector2(pk1.X, pk3.Y);
            Vector2 pk5 = new Vector2(pk2.X, pk3.Y);
            Vector2 pk6 = new Vector2(pn3.X, pk1.Y);
            Vector2 pk7 = new Vector2(pn2.X, pk6.Y);
            Vector2 pk8 = new Vector2(p10.X, pk7.Y);
            Vector2 pk9 = new Vector2(pk7.X, pk5.Y);
            Vector2 pk10 = new Vector2(pk8.X, pk9.Y);

            LwPolyline poly2 = new LwPolyline(); //
            poly2.Vertexes.Add(new LwPolylineVertex(pn12));
            poly2.Vertexes.Add(new LwPolylineVertex(pn11));
            poly2.Vertexes.Add(new LwPolylineVertex(pn10));
            poly2.Vertexes.Add(new LwPolylineVertex(pn9));
            poly2.Vertexes.Add(new LwPolylineVertex(pn8));
            poly2.Vertexes.Add(new LwPolylineVertex(pn7));
            poly2.Vertexes[5].Bulge = Math.Tan(pi / 4);
            poly2.Vertexes.Add(new LwPolylineVertex(pn6));
            poly2.Vertexes.Add(new LwPolylineVertex(pn5));
            poly2.Vertexes.Add(new LwPolylineVertex(pn4));
            poly2.Vertexes.Add(new LwPolylineVertex(pn3));
            poly2.Vertexes.Add(new LwPolylineVertex(pn2));
            poly2.Vertexes.Add(new LwPolylineVertex(pn1));
            fun.PolyFill(dxf, poly2, 0.3, contour);

            Vector2[] line6 = { pm9, pn8 };
            fun.drawBLine(dxf, line6, 0.3, contour);
            Vector2[] line7 = { pm18, pn9 };
            fun.drawBLine(dxf, line7, 0.3, contour);
            Vector2[] line8 = { pm19, pn10 };
            fun.drawBLine(dxf, line8, 0.3, contour);
            Vector2[] line9 = { pm11, pn11 };
            fun.drawBLine(dxf, line9, 0.3, contour);
            Vector2[] line10 = { pn5, pk1, pk2, p18 };
            fun.drawBLine(dxf, line10, 0.3, contour);
            Vector2[] line11 = { pn4, pk2, pk4, p9 };
            fun.drawBLine(dxf, line11, 0.3, contour);
            Vector2[] line12 = { pk3, pk4 };
            fun.drawBLine(dxf, line12, 0.3, contour);
            Vector2[] line13 = { pn3, p19 };
            fun.drawBLine(dxf, line13, 0.3, contour);
            Vector2[] line14 = { pk8, pk6, pk9, pk10 };
            fun.drawBLine(dxf, line14, 0.3, contour);
            Vector2[] line15 = { pn2, pk7 };
            fun.drawBLine(dxf, line15, 0.3, contour);
            Vector2[] line16 = { pk9, p11 };
            fun.drawBLine(dxf, line16, 0.3, contour);

            LwPolyline polyar1 = new LwPolyline();
            polyar1.Vertexes.Add(new LwPolylineVertex(pk1));
            polyar1.Vertexes[0].Bulge = Math.Tan(ang2 / 4);
            polyar1.Vertexes.Add(new LwPolylineVertex(pk3));
            fun.PolyFill(dxf, polyar1, 0.3, contour);

            Vector2[] cenline1 = { new Vector2(p0.X - 2, p0.Y), new Vector2(p0p.X + 2, p0.Y) };//主轴中心线
            fun.drawPlinetype(dxf, cenline1, 0.15, centre, Linetype.Center);

            //Circle circle1 = new Circle(pc0, r1);
            //circle1.Linetype = Linetype.Continuous;
            //dxf.AddEntity(circle1);

            LwPolyline polyc1 = new LwPolyline();//圆
            polyc1.Vertexes.Add(new LwPolylineVertex(new Vector2(pc0.X + r1, pc0.Y)));
            polyc1.Vertexes[0].Bulge = Math.Tan(pi / 4);
            polyc1.Vertexes.Add(new LwPolylineVertex(new Vector2(pc0.X - r1, pc0.Y)));
            polyc1.Vertexes[1].Bulge = Math.Tan(pi / 4);
            polyc1.Vertexes.Add(new LwPolylineVertex(new Vector2(pc0.X + r1, pc0.Y)));
            fun.PolyFill(dxf, polyc1, 0.3, contour);

            Vector2 px1 = new Vector2(p0p.X - lx1 - lx2 - lx3, p0.Y - dx2 / 2);
            Vector2 px2 = new Vector2(px1.X + lx3, px1.Y);
            Vector2 px3 = new Vector2(px2.X + lx2, px2.Y);
            Vector2 px4 = new Vector2(px3.X, p0.Y - dx1 / 2);
            Vector2 px5 = new Vector2(px4.X + lx1 - x1, px4.Y);
            Vector2 px6 = new Vector2(px5.X + x1, px5.Y - x1);
            Vector2 pxm1 = new Vector2(px1.X, -px1.Y);
            Vector2 pxm2 = new Vector2(px2.X, -px2.Y);
            Vector2 pxm3 = new Vector2(px3.X, -px3.Y);
            Vector2 pxm4 = new Vector2(px4.X, -px4.Y);
            Vector2 pxm5 = new Vector2(px5.X, -px5.Y);
            Vector2 pxm6 = new Vector2(px6.X, -px6.Y);
            Vector2 px7 = new Vector2(px2.X, p0.Y - dx3 / 2);
            Vector2 px8 = new Vector2(px7.X + lx2, px7.Y);
            Vector2 pxm7 = new Vector2(px7.X, -px7.Y);
            Vector2 pxm8 = new Vector2(px8.X, -px8.Y);

            Vector2[] linec1 = { px6, px5, px4, px3, px2, px1, pxm1, pxm2, pxm3, pxm4, pxm5, pxm6 };//内轮廓（虚线）
            fun.drawPlinetype(dxf, linec1, 0.15, contour, Linetype.Dashed);
            Vector2[] linec2 = { px2, pxm2, };
            fun.drawPlinetype(dxf, linec2, 0.15, contour, Linetype.Dashed);
            Vector2[] linec3 = { px3, pxm3, };
            fun.drawPlinetype(dxf, linec3, 0.15, contour, Linetype.Dashed);
            Vector2[] linec4 = { px5, pxm5, };
            fun.drawPlinetype(dxf, linec4, 0.15, contour, Linetype.Dashed);
            Vector2[] linec5 = { px7, px8, };
            fun.drawPlinetype(dxf, linec5, 0.15, contour, Linetype.Dashed);
            Vector2[] linec6 = { pxm7, pxm8, };
            fun.drawPlinetype(dxf, linec6, 0.15, contour, Linetype.Dashed);


            DimensionStyle dimensionStyle = fun.CreateDimStyle();//标注
            dimensionStyle.ArrowSize = 0.2;
            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
            dimensionStyle.TextHeight = 0.5;
            double offset = 7;

            LinearDimension linedim1 = new LinearDimension(new Line(p6, p17), offset * 3, 180, dimensionStyle);
            linedim1.UserText = String.Format("{0}", oal);
            dxf.AddEntity(linedim1);
            LinearDimension linedim2 = new LinearDimension(new Line(p8, p17), offset * 1.5, 180, dimensionStyle);
            linedim2.UserText = String.Format("{0}", lpr);
            dxf.AddEntity(linedim2);
            LinearDimension linedim3 = new LinearDimension(new Line(p17, pm17), offset, 270, dimensionStyle);
            linedim3.UserText = String.Format("{0}", bd1);
            dxf.AddEntity(linedim3);
            LinearDimension linedim4 = new LinearDimension(new Line(p8, pm8), offset * 3, 90, dimensionStyle);
            linedim4.UserText = String.Format("{0}", dcon);
            dxf.AddEntity(linedim4);
            LinearDimension linedim5 = new LinearDimension(new Line(pm8, pm10), offset + 15 / 2, 0, dimensionStyle);
            linedim5.UserText = String.Format("{0}", lpcon);
            dxf.AddEntity(linedim5);
            LinearDimension linedim6 = new LinearDimension(new Line(pm10, pm16), offset * 1.5, 0, dimensionStyle);
            linedim6.UserText = String.Format("{0}", lb2);
            dxf.AddEntity(linedim6);
            LinearDimension linedim7 = new LinearDimension(new Line(pm16, pm17), offset, 0, dimensionStyle);
            linedim7.UserText = String.Format("{0}", dcon);
            dxf.AddEntity(linedim7);


            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }

        public static void ReducerPrimaryDirection(Dictionary<string, Object> data)  //变径器，初步设计
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            double pi = Math.PI;

            double oal = 160;
            double lpr = 130;
            double lpcon = 16;
            double lb1 = 50;
            double lb2 = 64;
            double dcon = 50;
            double bd1 = 42;
            double bd2 = 48;
            double x1 = 1;//倒角
            double lh = oal - lpr;
            double lh1 = 9;
            double lh2 = 10;
            double lh3 = lh - x1 - lh1 - lh2;
            double dc1 = 30; //左端最小直径
            double r1 = 2;
            double r2 = 1;
            double lc1 = 18;
            double lc2 = 6;
            double dc2 = 12;
            double lp1 = 5;
            double lp2 = 5;
            double lp3 = 5;
            double dp1 = 42;
            double x2 = 3;//倒角
            double lx1 = 18;
            double lx2 = 6;
            double dx1 = 20;
            double dx2 = 18;
            double ang1 = 5 * pi / 180;
            double ang2 = pi / 6;
            string path = "E:\\dxfp\\ReducerPrimaryDirection.dxf";
            /*
            double oal = Convert.ToDouble(data["oal"]);
            double lpr = Convert.ToDouble(data["lpr"]);
            double lpcon = Convert.ToDouble(data["lpcon"]);
            double lb1 = Convert.ToDouble(data["lb1"]);
            double lb2 = Convert.ToDouble(data["lb2"]);
            double dcon = Convert.ToDouble(data["dcon"]);
            double bd1 = Convert.ToDouble(data["bd1"]);
            double bd2 = Convert.ToDouble(data["bd2"]);
            double x1 = Convert.ToDouble(data["x1"]);//倒角
            double lh = oal - lpr;
            double lh1 = Convert.ToDouble(data["lh1"]);
            double lh2 = Convert.ToDouble(data["lh2"]);
            double lh3 = lh - x1 - lh1 - lh2;
            double dc1 = Convert.ToDouble(data["dc1"]);//左端最小直径
            double r1 = Convert.ToDouble(data["r1"]);
            double r2 = Convert.ToDouble(data["r2"]);
            double lc1 = Convert.ToDouble(data["lc1"]);
            double lc2 = Convert.ToDouble(data["lc2"]);
            double dc2 = Convert.ToDouble(data["dc2"]);
            double lp1 = Convert.ToDouble(data["lp1"]);
            double lp2 = Convert.ToDouble(data["lp2"]);
            double lp3 = Convert.ToDouble(data["lp3"]);
            double dp1 = Convert.ToDouble(data["dp1"]);
            double x2 = Convert.ToDouble(data["x2"]);//倒角
            double lx1 = Convert.ToDouble(data["lx1"]);
            double lx2 = Convert.ToDouble(data["lx2"]);
            double dx1 = Convert.ToDouble(data["dx1"]);
            double dx2 = Convert.ToDouble(data["dx2"]);
            double ang1 = Convert.ToDouble(data["ang1"])*pi/180;
            double ang2 = Convert.ToDouble(data["ang2"])*pi/180;
            string path = Convert.ToDouble(data["path"]);
            */
            Vector2 p0 = new Vector2(0, 0);
            Vector2 p0p = new Vector2(p0.X + oal, p0.Y);
            Vector2 p1 = new Vector2(p0.X + lc1, p0.Y);
            Vector2 p2 = new Vector2(p1.X, p1.Y - dc2 / 2 + r1);
            Vector2 p3 = new Vector2(p2.X - r1, p2.Y - r1);
            Vector2 p4 = new Vector2(p0.X + lc2 + r2, p3.Y);
            Vector2 p5 = new Vector2(p0.X + lc2, p3.Y - r2);
            Vector2 p6 = new Vector2(p0.X, p5.Y);
            Vector2 p7 = new Vector2(p0.X, p0.Y - dc1 / 2);
            Vector2 p8 = new Vector2(p7.X + x1, p7.Y - x1);
            Vector2 p9 = new Vector2(p8.X + lh1, p8.Y - lh1 * Math.Tan(ang1));
            Vector2 p10 = new Vector2(p9.X + lh2, p9.Y - lh2 * Math.Tan(ang1));
            Vector2 p11 = new Vector2(p10.X + lh3, p10.Y - lh3 * Math.Tan(ang1));
            Vector2 p12 = new Vector2(p0.X + lh, p0.Y - dcon / 2);
            Vector2 p13 = new Vector2(p12.X + lp1, p12.Y + lp1 * Math.Tan(ang2));
            Vector2 p14 = new Vector2(p13.X + x1, p13.Y + x1);
            Vector2 p15 = new Vector2(p14.X, p0.Y - dp1 / 2);
            Vector2 p16 = new Vector2(p15.X + lp2 - 2 * x1, p15.Y);
            Vector2 p17 = new Vector2(p16.X, p14.Y);
            Vector2 p18 = new Vector2(p17.X + x1, p13.Y);
            Vector2 p19 = new Vector2(p18.X + lp3, p12.Y);
            Vector2 p20 = new Vector2(p19.X + x1, p0.Y - bd2 / 2);
            Vector2 p21 = new Vector2(p20.X + lb2 - x2, p20.Y);
            Vector2 p22 = new Vector2(p21.X + x2, p0.Y - bd1 / 2);
            Vector2 p23 = new Vector2(p22.X + lb1, p22.Y);
            Vector2 pm2 = new Vector2(p2.X, -p2.Y);
            Vector2 pm3 = new Vector2(p3.X, -p3.Y);
            Vector2 pm4 = new Vector2(p0.X, pm3.Y);
            Vector2 pm7 = new Vector2(p7.X, -p7.Y);
            Vector2 pm8 = new Vector2(p8.X, -p8.Y);
            Vector2 pm9 = new Vector2(p9.X, -p9.Y);
            Vector2 pm10 = new Vector2(p10.X, -p10.Y);
            Vector2 pm11 = new Vector2(p11.X, -p11.Y);
            Vector2 pm12 = new Vector2(p12.X, -p12.Y);
            Vector2 pm13 = new Vector2(p13.X, -p13.Y);
            Vector2 pm14 = new Vector2(p14.X, -p14.Y);
            Vector2 pm15 = new Vector2(p15.X, -p15.Y);
            Vector2 pm16 = new Vector2(p16.X, -p16.Y);
            Vector2 pm17 = new Vector2(p17.X, -p17.Y);
            Vector2 pm18 = new Vector2(p18.X, -p18.Y);
            Vector2 pm19 = new Vector2(p19.X, -p19.Y);
            Vector2 pm20 = new Vector2(p20.X, -p20.Y);
            Vector2 pm21 = new Vector2(p21.X, -p21.Y);
            Vector2 pm22 = new Vector2(p22.X, -p22.Y);
            Vector2 pm23 = new Vector2(p23.X, -p23.Y);

            LwPolyline poly1 = new LwPolyline(); //
            poly1.Vertexes.Add(new LwPolylineVertex(p1));
            poly1.Vertexes.Add(new LwPolylineVertex(pm2));
            poly1.Vertexes[1].Bulge = Math.Tan(pi / 8);
            poly1.Vertexes.Add(new LwPolylineVertex(pm3));
            poly1.Vertexes.Add(new LwPolylineVertex(pm4));
            poly1.Vertexes.Add(new LwPolylineVertex(pm7));
            poly1.Vertexes.Add(new LwPolylineVertex(pm8));
            poly1.Vertexes.Add(new LwPolylineVertex(pm9));
            poly1.Vertexes[6].Bulge = Math.Tan(pi / 16);
            poly1.Vertexes.Add(new LwPolylineVertex(pm10));
            poly1.Vertexes.Add(new LwPolylineVertex(pm11));
            poly1.Vertexes.Add(new LwPolylineVertex(pm12));
            poly1.Vertexes.Add(new LwPolylineVertex(pm13));
            poly1.Vertexes.Add(new LwPolylineVertex(pm14));
            poly1.Vertexes.Add(new LwPolylineVertex(pm15));
            poly1.Vertexes.Add(new LwPolylineVertex(pm16));
            poly1.Vertexes.Add(new LwPolylineVertex(pm17));
            poly1.Vertexes.Add(new LwPolylineVertex(pm18));
            poly1.Vertexes.Add(new LwPolylineVertex(pm19));
            poly1.Vertexes.Add(new LwPolylineVertex(pm20));
            poly1.Vertexes.Add(new LwPolylineVertex(pm21));
            poly1.Vertexes.Add(new LwPolylineVertex(pm22));
            poly1.Vertexes.Add(new LwPolylineVertex(pm23));
            poly1.Vertexes.Add(new LwPolylineVertex(p23));
            poly1.Vertexes.Add(new LwPolylineVertex(p22));
            poly1.Vertexes.Add(new LwPolylineVertex(p21));
            poly1.Vertexes.Add(new LwPolylineVertex(p20));
            poly1.Vertexes.Add(new LwPolylineVertex(p19));
            poly1.Vertexes.Add(new LwPolylineVertex(p18));
            poly1.Vertexes.Add(new LwPolylineVertex(p17));
            poly1.Vertexes.Add(new LwPolylineVertex(p16));
            poly1.Vertexes.Add(new LwPolylineVertex(p15));
            poly1.Vertexes.Add(new LwPolylineVertex(p14));
            poly1.Vertexes.Add(new LwPolylineVertex(p13));
            poly1.Vertexes.Add(new LwPolylineVertex(p12));
            poly1.Vertexes.Add(new LwPolylineVertex(p11));
            poly1.Vertexes.Add(new LwPolylineVertex(p10));
            poly1.Vertexes[34].Bulge = Math.Tan(pi / 16);
            poly1.Vertexes.Add(new LwPolylineVertex(p9));
            poly1.Vertexes.Add(new LwPolylineVertex(p8));
            poly1.Vertexes.Add(new LwPolylineVertex(p7));
            poly1.Vertexes.Add(new LwPolylineVertex(p6));
            poly1.Vertexes.Add(new LwPolylineVertex(p5));
            poly1.Vertexes[39].Bulge = Math.Tan(pi / 8);
            poly1.Vertexes.Add(new LwPolylineVertex(p4));
            poly1.Vertexes.Add(new LwPolylineVertex(p3));
            poly1.Vertexes[41].Bulge = Math.Tan(pi / 8);
            poly1.Vertexes.Add(new LwPolylineVertex(p2));
            poly1.Vertexes.Add(new LwPolylineVertex(p1));
            fun.PolyFill(dxf, poly1, 0.3, contour);

            Vector2[] cenline1 = { new Vector2(p0.X - 2, p0.Y), new Vector2(p0p.X + 2, p0.Y) };//主轴中心线
            fun.drawPlinetype(dxf, cenline1, 0.15, centre, Linetype.Center);

            //Circle circle1 = new Circle(pc0, r1);
            //circle1.Linetype = Linetype.Continuous;
            //dxf.AddEntity(circle1);

            Vector2 pc0 = new Vector2(p14.X + x1, p0.Y);

            LwPolyline polyc1 = new LwPolyline();//圆
            polyc1.Vertexes.Add(new LwPolylineVertex(new Vector2(pc0.X + (lp1 + x1), pc0.Y)));
            polyc1.Vertexes[0].Bulge = Math.Tan(pi / 4);
            polyc1.Vertexes.Add(new LwPolylineVertex(new Vector2(pc0.X - (lp1 + x1), pc0.Y)));
            polyc1.Vertexes[1].Bulge = Math.Tan(pi / 4);
            polyc1.Vertexes.Add(new LwPolylineVertex(new Vector2(pc0.X + (lp1 + x1), pc0.Y)));
            fun.PolyFill(dxf, polyc1, 0.3, contour);

            LwPolyline polyc2 = new LwPolyline();//圆
            polyc2.Vertexes.Add(new LwPolylineVertex(new Vector2(pc0.X + (lp1 - x1 / 2), pc0.Y)));
            polyc2.Vertexes[0].Bulge = Math.Tan(pi / 4);
            polyc2.Vertexes.Add(new LwPolylineVertex(new Vector2(pc0.X - (lp1 - x1 / 2), pc0.Y)));
            polyc2.Vertexes[1].Bulge = Math.Tan(pi / 4);
            polyc2.Vertexes.Add(new LwPolylineVertex(new Vector2(pc0.X + (lp1 - x1 / 2), pc0.Y)));
            fun.PolyFill(dxf, polyc2, 0.3, contour);

            Vector2[] line1 = { p11, pm11 };
            fun.drawBLine(dxf, line1, 0.3, contour);
            Vector2[] line2 = { p19, pm19 };
            fun.drawBLine(dxf, line2, 0.3, contour);
            Vector2[] line3 = { p20, pm20 };
            fun.drawBLine(dxf, line3, 0.3, contour);
            Vector2[] line4 = { p21, pm21 };
            fun.drawBLine(dxf, line4, 0.3, contour);
            Vector2[] line5 = { p22, pm22 };
            fun.drawBLine(dxf, line5, 0.3, contour);

            Vector2 pa1 = new Vector2(pc0.X + (lp1 + x1), pc0.Y);
            Vector2 pa2 = new Vector2(pc0.X - (lp1 + x1), pc0.Y);

            /*
            Arc arc1 = fun.DrawArc(new Vector2(pc0.X, pc0.Y + (lp1 + x1)), pc0, new Vector2(pc0.X - (lp1 + x1), pc0.Y));//XXXXXXX
            Vector2 pjd1 = fun.getPointForArcandLine(pm13, p13, pc0, arc1);
            Vector2[] linet1 = { p13, pjd1 };
            fun.drawBLine(dxf, linet1, 0.3, contour);
            */
            Arc arc1 = fun.DrawArc(pa1, pc0, pa2);

            Vector2 pj1 = fun.getPointForArcandLine(p13, pm13, pc0, arc1);//直线与圆弧交点1
            Vector2[] linet1 = { pj1, pm13 };
            fun.drawBLine(dxf, linet1, 0.3, contour);
            Vector2 pj2 = fun.getPointForArcandLine(p15, pm15, pc0, arc1);//直线与圆弧交点2
            Vector2[] linet2 = { pj2, pm15 };
            fun.drawBLine(dxf, linet2, 0.3, contour);
            Vector2 pj3 = fun.getPointForArcandLine(p16, pm16, pc0, arc1);//直线与圆弧交点
            Vector2[] linet3 = { pj3, pm16 };
            fun.drawBLine(dxf, linet3, 0.3, contour);
            Vector2 pj4 = fun.getPointForArcandLine(p18, pm18, pc0, arc1);//直线与圆弧交点
            Vector2[] linet4 = { pj4, pm18 };
            fun.drawBLine(dxf, linet4, 0.3, contour);

            Arc arc2 = fun.DrawArc(pa2, pc0, pa1);

            Vector2 pj5 = fun.getPointForArcandLine(p13, pm13, pc0, arc2);//直线与圆弧交点1
            Vector2[] linet5 = { pj5, p13 };
            fun.drawBLine(dxf, linet5, 0.3, contour);
            Vector2 pj6 = fun.getPointForArcandLine(p15, pm15, pc0, arc2);//直线与圆弧交点2
            Vector2[] linet6 = { pj6, p15 };
            fun.drawBLine(dxf, linet6, 0.3, contour);
            Vector2 pj7 = fun.getPointForArcandLine(p16, pm16, pc0, arc2);//直线与圆弧交点
            Vector2[] linet7 = { pj7, p16 };
            fun.drawBLine(dxf, linet7, 0.3, contour);
            Vector2 pj8 = fun.getPointForArcandLine(p18, pm18, pc0, arc2);//直线与圆弧交点
            Vector2[] linet8 = { pj8, p18 };
            fun.drawBLine(dxf, linet8, 0.3, contour);

            Vector2 px1 = new Vector2(p0p.X, p0p.Y + dx1 / 2);
            Vector2 px2 = new Vector2(p0p.X - lx1, p0p.Y + dx2 / 2);
            Vector2 px3 = new Vector2(px2.X - lx2, px2.Y);
            Vector2 px4 = new Vector2(px3.X, -px3.Y);
            Vector2 px5 = new Vector2(px2.X, -px2.Y);
            Vector2 px6 = new Vector2(px1.X, -px1.Y);

            Vector2[] linex1 = { px1, px2, px3, px4, px5, px6 };//内轮廓（虚线）
            fun.drawPlinetype(dxf, linex1, 0.15, contour, Linetype.Dashed);
            Vector2[] linex2 = { px2, px5 };//内轮廓（虚线）
            fun.drawPlinetype(dxf, linex2, 0.15, contour, Linetype.Dashed);

            DimensionStyle dimensionStyle = fun.CreateDimStyle();//标注
            dimensionStyle.ArrowSize = 0.2;
            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
            dimensionStyle.TextHeight = 0.5;
            double offset = 7;

            LinearDimension linedim1 = new LinearDimension(new Line(p7, p23), offset * 3, 180, dimensionStyle);
            linedim1.UserText = String.Format("{0}", oal);
            dxf.AddEntity(linedim1);
            LinearDimension linedim2 = new LinearDimension(new Line(p12, p23), offset * 1.5, 180, dimensionStyle);
            linedim2.UserText = String.Format("{0}", lpr);
            dxf.AddEntity(linedim2);
            LinearDimension linedim3 = new LinearDimension(new Line(p12, pm12), offset * 5, 90, dimensionStyle);
            linedim3.UserText = String.Format("{0}", dcon);
            dxf.AddEntity(linedim3);
            LinearDimension linedim4 = new LinearDimension(new Line(pm12, pm20), offset, 0, dimensionStyle);
            linedim4.UserText = String.Format("{0}", lpcon);
            dxf.AddEntity(linedim4);
            LinearDimension linedim5 = new LinearDimension(new Line(p21, pm21), offset * 10, 270, dimensionStyle);
            linedim5.UserText = String.Format("{0}", bd2);
            dxf.AddEntity(linedim5);
            LinearDimension linedim6 = new LinearDimension(new Line(p23, pm23), offset, 270, dimensionStyle);
            linedim6.UserText = String.Format("{0}", bd1);
            dxf.AddEntity(linedim6);

            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }

        /*
        public static void ConverterRotationallySymmetric(Dictionary<string, Object> data)  //转换器，旋转对称
        {
            DxfDocument dxf = new DxfDocument();
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层

            double pi = Math.PI;

            double bd = 48; //Convert.ToDouble(data["bd"]);
            double bhta = 48; //Convert.ToDouble(data["bhta"]);
            double bted = 48; //Convert.ToDouble(data["bted"]);
            double crks = 48; //Convert.ToDouble(data["crks"]);
            double dconws = 48; //Convert.ToDouble(data["dconws"]);
            double df = 48; //Convert.ToDouble(data["df"]);
            double lb = 48; //Convert.ToDouble(data["lb"]);
            double lf = 48; //Convert.ToDouble(data["lf"]);
            double lpcon = 48; //Convert.ToDouble(data["lpcon"]);
            double lpr = 48; //Convert.ToDouble(data["lpr"]);
            double lsc = 48; //Convert.ToDouble(data["lsc"]);
            double oal = 48; //Convert.ToDouble(data["oal"]);



        }
        */

        public static void ConverterRotationallySymmetric(Dictionary<string, Object> data)    //转换器,旋转对称
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);

            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            string ccms1 = Convert.ToString(data["ccms1"]);//机床侧skg10/skg30/skg40

            if (ccms1 == "skg10" || ccms1 == "skg30" || ccms1 == "skg40")
            {
                double soal = Convert.ToDouble(data["l1"]) + Convert.ToDouble(data["lpcon"]) + Convert.ToDouble(data["lb"]);//总长度
                double scale = Convert.ToDouble(data["scale"]);//比例
                if (scale == 0)
                {
                    if (soal < 53.8)
                    {
                        scale = 5.0;
                    }
                    else if (soal < 67.25)
                    {
                        scale = 4.0;
                    }
                    else if (soal < 90)
                    {
                        scale = 3.0;
                    }
                    else if (soal < 134.5)
                    {
                        scale = 1.5;
                    }
                    else if (soal < 269)
                    {
                        scale = 1.0;
                    }
                    else if (soal < 359)
                    {
                        scale = 0.75;
                    }
                    else
                    {
                        scale = 0.5;
                    }
                }//比例判断
                double lb = Convert.ToDouble(data["lb"]) * scale;//体长
                double lpcon = Convert.ToDouble(data["lpcon"]) * scale;//连接伸出长度
                double lpr = 69.1 * scale; ;//伸出长度
                double l1 = Convert.ToDouble(data["l1"]) * scale;
                double oal = 116.9 * scale; ;//总长度
                //法兰
                double v = Convert.ToDouble(data["v"]) * scale;
                double x = Convert.ToDouble(data["x"]) * scale;
                double y = Convert.ToDouble(data["y"]) * scale;
                double r4 = Convert.ToDouble(data["r4"]) * scale;
                double β1 = Convert.ToDouble(data["b1"]) * pi / 180;
                double d4 = Convert.ToDouble(data["d4"]) * scale;
                double f = Convert.ToDouble(data["f"]) * scale;
                //工件侧
                double ll1 = Convert.ToDouble(data["ll1"]) * scale;
                double ll4 = Convert.ToDouble(data["ll4"]) * scale;
                double lsc = Convert.ToDouble(data["lsc"]) * scale; ;//夹紧长度
                double dconws = Convert.ToDouble(data["dconws"]) * scale;//工件侧连接直径
                double bted = Convert.ToDouble(data["bted"]) * scale;//体锥度端径
                double bd = Convert.ToDouble(data["bd"]) * scale;//体直径
                double bhta = Convert.ToDouble(data["bhta"]) * pi / 180;//体半锥角
                double ll2 = Convert.ToDouble(data["ll2"]) * scale;
                double lf = 51.1 * scale; ;//功能长度
                double dd3 = Convert.ToDouble(data["dd3"]) * scale;
                double p2 = Convert.ToDouble(data["p2"]) * scale;//螺距
                double xj2 = 7 * scale;//螺纹小径2
                double ct = Convert.ToDouble(data["ct"]) * scale;
                //skg
                double crks = Convert.ToDouble(data["crks"]) * scale;//连接保持旋钮螺纹尺寸
                double p = Convert.ToDouble(data["p"]) * scale;//螺距
                double xj = 13 * scale;//螺纹小径1
                double df = Convert.ToDouble(data["df"]) * scale;//法兰直径
                string ccms = Convert.ToString(data["ccms"]);
                double czc = Convert.ToDouble(data["czc"]);
                double b = Convert.ToDouble(data["b"]) * scale;
                double d1 = Convert.ToDouble(data["d1"]) * scale;
                double d2 = Convert.ToDouble(data["d2"]) * scale;
                double d7 = Convert.ToDouble(data["d7"]) * scale;
                double d11 = Convert.ToDouble(data["d11"]) * scale;
                double l2 = Convert.ToDouble(data["l2"]) * scale;
                double l3 = Convert.ToDouble(data["l3"]) * scale;
                double l4 = Convert.ToDouble(data["l4"]) * scale;
                double l7 = Convert.ToDouble(data["l7"]) * scale;
                double r1 = Convert.ToDouble(data["r1"]) * scale;
                double r2 = Convert.ToDouble(data["r2"]) * scale;
                double β = Convert.ToDouble(data["bb"]) * pi / 180;
                if (ccms1 == "skg10")//机床测1
                {
                    if (ccms == "a")
                    {
                        if (czc == 30)
                        {
                            b = 16.1 * scale;
                            d1 = 31.75 * scale;
                            d2 = 13 * scale;
                            d4 = 44.3 * scale;
                            df = 50 * scale;
                            crks = 12 * scale;
                            p = 1.5 * scale;
                            xj = crks - 1.0852 * p;
                            d11 = 14.5 * scale;
                            f = 15.9 * scale;
                            l1 = 47.8 * scale;
                            l2 = 24 * scale;
                            l3 = 33.5 * scale;
                            l4 = 5.5 * scale;
                            l7 = 1.6 * scale;
                            r1 = 0.6 * scale;
                            r2 = 0.8 * scale;
                            lpcon = 19.1 * scale;
                            v = 11.1 * scale;
                            y = 3.2 * scale;
                            x = 3.75 * scale;
                            β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                            β1 = 60 * pi / 180;
                            r4 = 1 * scale;
                        }
                        if (czc == 40)
                        {
                            b = 16.1 * scale;
                            d1 = 44.45 * scale;
                            d2 = 17 * scale;
                            d4 = 56.25 * scale;
                            df = 63.55 * scale;
                            crks = 16 * scale;
                            p = 1.5 * scale;
                            xj = crks - 1.0852 * p;
                            d11 = 19 * scale;
                            f = 15.9 * scale;
                            l1 = 68.4 * scale;
                            l2 = 32 * scale;
                            l3 = 42.5 * scale;
                            l4 = 8.2 * scale;
                            l7 = 1.6 * scale;
                            r1 = 1.2 * scale;
                            r2 = 1 * scale;
                            lpcon = 19.1 * scale;
                            v = 11.1 * scale;
                            x = 3.75 * scale;
                            y = 3.2 * scale;
                            β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                            β1 = 60 * pi / 180;
                            r4 = 1 * scale;
                        }
                        if (czc == 45)
                        {
                            b = 19.3 * scale;
                            d1 = 57.15 * scale;
                            d2 = 21 * scale;
                            d4 = 75.25 * scale;
                            df = 82.55 * scale;
                            crks = 20 * scale;
                            p = 1.5 * scale;
                            xj = crks - 1.0852 * p;
                            d11 = 23.5 * scale;
                            f = 15.9 * scale;
                            l1 = 82.7 * scale;
                            l2 = 40 * scale;
                            l3 = 52.5 * scale;
                            l4 = 10 * scale;
                            l7 = 1.6 * scale;
                            r1 = 2 * scale;
                            r2 = 1.2 * scale;
                            lpcon = 19.1 * scale;
                            v = 11.1 * scale;
                            x = 3.75 * scale;
                            y = 3.2 * scale;
                            β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                            β1 = 60 * pi / 180;
                            r4 = 1 * scale;
                        }
                        if (czc == 50)
                        {
                            b = 25.7 * scale;
                            d1 = 69.85 * scale;
                            d4 = 91.25 * scale;
                            df = 97.5 * scale;
                            d2 = 25 * scale;
                            crks = 24 * scale;
                            p = 1.5 * scale;
                            xj = crks - 1.0852 * p;
                            d11 = 28 * scale;
                            f = 15.9 * scale;
                            l1 = 101.75 * scale;
                            l2 = 47 * scale;
                            l3 = 61.5 * scale;
                            l4 = 11.5 * scale;
                            l7 = 2 * scale;
                            r1 = 2.5 * scale;
                            r2 = 1.5 * scale;
                            lpcon = 19.1 * scale;
                            v = 11.1 * scale;
                            x = 3.75 * scale;
                            y = 3.2 * scale;
                            β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                            β1 = 60 * pi / 180;
                            r4 = 1 * scale;
                        }
                        if (czc == 60)
                        {
                            b = 25.7 * scale;
                            d1 = 107.95 * scale;
                            d2 = 32 * scale;
                            d4 = 147.7 * scale;
                            df = 155 * scale;
                            crks = 30 * scale;
                            p = 1.5 * scale;
                            xj = crks - 1.0852 * p;
                            d11 = 36 * scale;
                            f = 15.9 * scale;
                            l1 = 161.9 * scale;
                            l2 = 59 * scale;
                            l3 = 76 * scale;
                            l4 = 14 * scale;
                            l7 = 2 * scale;
                            r1 = 3.5 * scale;
                            r2 = 2 * scale;
                            lpcon = 19.1 * scale;
                            v = 11.1 * scale;
                            x = 3.75 * scale;
                            y = 3.2 * scale;
                            β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                            β1 = 60 * pi / 180;
                            r4 = 1 * scale;
                        }
                    }
                    if (ccms == "u")
                    {
                        if (czc == 30)
                        {
                            b = 16.1 * scale;
                            d1 = 31.75 * scale;
                            d2 = 13 * scale;
                            d4 = 39.15 * scale;
                            crks = 12 * scale;
                            p = 1.5 * scale;
                            xj = crks - 1.0852 * p;
                            d7 = 12 * scale;
                            d11 = 14.5 * scale;
                            f = 15.9 * scale;
                            l1 = 47.8 * scale;
                            l2 = 24 * scale;
                            l3 = 33.5 * scale;
                            l4 = 5.5 * scale;
                            l7 = 1.6 * scale;
                            r1 = 0.6 * scale;
                            r2 = 0.8 * scale;
                            lpcon = 19.1 * scale;
                            v = 11.1 * scale;
                            x = 3.75 * scale;
                            y = 3.2 * scale;
                            β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                            β1 = 60 * pi / 180;
                            r4 = 1 * scale;
                        }
                        if (czc == 40)
                        {
                            b = 16.1 * scale;
                            d1 = 44.45 * scale;
                            d2 = 17 * scale;
                            d4 = 56.25 * scale;
                            df = 63.55 * scale;
                            crks = 16 * scale;
                            p = 1.5 * scale;
                            xj = crks - 1.0852 * p;
                            d11 = 19 * scale;
                            f = 15.9 * scale;
                            l1 = 68.4 * scale;
                            l2 = 32 * scale;
                            l3 = 42.5 * scale;
                            l4 = 8.2 * scale;
                            l7 = 1.6 * scale;
                            r1 = 1.2 * scale;
                            r2 = 1 * scale;
                            lpcon = 19.1 * scale;
                            v = 11.1 * scale;
                            x = 3.75 * scale;
                            y = 3.2 * scale;
                            β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                            β1 = 60 * pi / 180;
                            r4 = 1 * scale;
                        }
                        if (czc == 45)
                        {
                            b = 19.3 * scale;
                            d1 = 57.15 * scale;
                            d2 = 21 * scale;
                            d4 = 75.25 * scale;
                            df = 82.55 * scale;
                            crks = 20 * scale;
                            p = 1.5 * scale;
                            xj = crks - 1.0852 * p;
                            d11 = 23.5 * scale;
                            f = 15.9 * scale;
                            l1 = 82.7 * scale;
                            l2 = 40 * scale;
                            l3 = 52.5 * scale;
                            l4 = 10 * scale;
                            l7 = 1.6 * scale;
                            r1 = 2 * scale;
                            r2 = 1.2 * scale;
                            lpcon = 19.1 * scale;
                            v = 11.1 * scale;
                            x = 3.75 * scale;
                            y = 3.2 * scale;
                            β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                            β1 = 60 * pi / 180;
                            r4 = 1 * scale;
                        }
                        if (czc == 50)
                        {
                            b = 25.7 * scale;
                            d1 = 69.85 * scale;
                            d2 = 25 * scale;
                            d4 = 91.25 * scale;
                            df = 98.5 * scale;
                            crks = 24 * scale;
                            p = 1.5 * scale;
                            xj = crks - 1.0852 * p;
                            d11 = 28 * scale;
                            f = 15.9 * scale;
                            l1 = 101.75 * scale;
                            l2 = 47 * scale;
                            l3 = 61.5 * scale;
                            l4 = 11.5 * scale;
                            l7 = 2 * scale;
                            r1 = 2.5 * scale;
                            r2 = 1.5 * scale;
                            lpcon = 19.1 * scale;
                            v = 11.1 * scale;
                            x = 3.75 * scale;
                            y = 3.2 * scale;
                            β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                            β1 = 60 * pi / 180;
                            r4 = 1 * scale;
                        }
                        if (czc == 60)
                        {
                            b = 25.7 * scale;
                            d1 = 107.95 * scale;
                            d2 = 32 * scale;
                            d4 = 132.8 * scale;
                            df = 139.75 * scale;
                            crks = 30 * scale;
                            p = 1.5 * scale;
                            xj = crks - 1.0852 * p;
                            d11 = 36 * scale;
                            f = 15.9 * scale;
                            l1 = 161.9 * scale;
                            l2 = 59 * scale;
                            l3 = 76 * scale;
                            l4 = 14 * scale;
                            l7 = 2 * scale;
                            r1 = 3.5 * scale;
                            r2 = 2 * scale;
                            lpcon = 19.1 * scale;
                            v = 11.1 * scale;
                            x = 3.75 * scale;
                            y = 3.2 * scale;
                            β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                            β1 = 60 * pi / 180;
                            r4 = 1 * scale;
                        }
                    }
                }
                if (ccms1 == "skg30")//英制
                {
                    if (czc == 30)
                    {
                        b = 16.383 * scale;
                        d1 = 31.75 * scale;
                        d2 = 13.1064 * scale;
                        d4 = 38.8874 * scale;
                        df = 46.0248 * scale;
                        crks = 12.7 * scale;
                        p = 1.9538 * scale;
                        xj = crks - 1.08253175 * p;
                        d11 = 14.986 * scale;
                        f = 15.875 * scale;
                        l1 = 47.625 * scale;
                        l2 = 25.4 * scale;
                        l3 = 35.4 * scale;
                        l4 = 4.7752 * scale;
                        l7 = 0.762 * scale;
                        r1 = 0.508 * scale;
                        r2 = (d11 - d2) / 2 / Math.Tan(30 * pi / 180);
                        lpcon = 19.05 * scale;
                        v = 11.1125 * scale;
                        y = 3.175 * scale;
                        x = 7.1882 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 40)
                    {
                        b = 16.383 * scale;
                        d1 = 44.45 * scale;
                        d2 = 16.2814 * scale;
                        d4 = 56.3626 * scale;
                        df = 63.5 * scale;
                        crks = 15.875 * scale;
                        p = 2.3091 * scale;
                        xj = crks - 1.08253175 * p;
                        d11 = 18.288 * scale;
                        f = 15.875 * scale;
                        l1 = 68.2498 * scale;
                        l2 = 28.448 * scale;
                        l3 = 38.448 * scale;
                        l4 = 4.7752 * scale;
                        l7 = 0.762 * scale;
                        r1 = 1.016 * scale;
                        r2 = (d11 - d2) / 2 / Math.Tan(30 * pi / 180);
                        lpcon = 19.05 * scale;
                        v = 11.1125 * scale;
                        y = 3.175 * scale;
                        x = 7.1882 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;

                    }
                    if (czc == 45)
                    {
                        b = 19.558 * scale;
                        d1 = 57.15 * scale;
                        d2 = 19.4564 * scale;
                        d4 = 74.9046 * scale;
                        df = 82.55 * scale;
                        crks = 19.05 * scale;
                        p = 2.54 * scale;
                        xj = crks - 1.08253175 * p;
                        d11 = 21.59 * scale;
                        f = 15.875 * scale;
                        l1 = 82.55 * scale;
                        l2 = 38.1 * scale;
                        l3 = 48.1 * scale;
                        l4 = 4.7752 * scale;
                        l7 = 0.762 * scale;
                        r1 = 1.016 * scale;
                        r2 = (d11 - d2) / 2 / Math.Tan(30 * pi / 180);
                        lpcon = 19.05 * scale;
                        v = 11.1125 * scale;
                        y = 3.175 * scale;
                        x = 7.1882 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 50)
                    {
                        b = 25.908 * scale;
                        d1 = 69.85 * scale;
                        d2 = 26.1874 * scale;
                        d4 = 91.2876 * scale;
                        df = 98.425 * scale;
                        crks = 25.4 * scale;
                        p = 3.175 * scale;
                        xj = crks - 1.08253175 * p;
                        d11 = 28.575 * scale;
                        f = 15.875 * scale;
                        l1 = 101.6 * scale;
                        l2 = 44.45 * scale;
                        l3 = 54.45 * scale;
                        l4 = 6.35 * scale;
                        l7 = 0.762 * scale;
                        r1 = 1.016 * scale;
                        r2 = (d11 - d2) / 2 / Math.Tan(30 * pi / 180);
                        lpcon = 19.05 * scale;
                        v = 11.1125 * scale;
                        y = 3.175 * scale;
                        x = 7.1882 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 60)
                    {
                        b = 25.908 * scale;
                        d1 = 107.95 * scale;
                        d2 = 32.5374 * scale;
                        d4 = 132.5626 * scale;
                        df = 139.7 * scale;
                        crks = 31.75 * scale;
                        p = 3.6286 * scale;
                        xj = crks - 1.08253175 * p;
                        d11 = 34.925 * scale;
                        f = 15.875 * scale;
                        l1 = 161.925 * scale;
                        l2 = 57.15 * scale;
                        l3 = 67.15 * scale;
                        l4 = 7.9248 * scale;
                        l7 = 1.016 * scale;
                        r1 = 1.016 * scale;
                        r2 = (d11 - d2) / 2 / Math.Tan(30 * pi / 180);
                        lpcon = 19.05 * scale;
                        v = 11.1125 * scale;
                        y = 3.175 * scale;
                        x = 7.1882 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                }
                if (ccms1 == "skg40")//米制
                {
                    if (czc == 30)
                    {
                        b = 16.383 * scale;
                        d1 = 31.75 * scale;
                        d2 = 13.1064 * scale;
                        d4 = 38.8874 * scale;
                        df = 46.0248 * scale;
                        crks = 12 * scale;
                        p = 1.5 * scale;
                        xj = crks - 1.0825 * p;
                        d11 = 14.986 * scale;
                        f = 15.875 * scale;
                        l1 = 47.625 * scale;
                        l2 = 25.4 * scale;
                        l3 = 35.4 * scale;
                        l4 = 4.7752 * scale;
                        l7 = 0.762 * scale;
                        r1 = 0.508 * scale;
                        r2 = (d11 - d2) / 2 / Math.Tan(30 * pi / 180);
                        lpcon = 19.05 * scale;
                        v = 11.1125 * scale;
                        y = 3.175 * scale;
                        x = 7.1882 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 40)
                    {
                        b = 16.383 * scale;
                        d1 = 44.45 * scale;
                        d2 = 16.2814 * scale;
                        d4 = 56.3626 * scale;
                        df = 63.5 * scale;
                        crks = 16 * scale;
                        p = 1.5 * scale;
                        xj = crks - 1.0825 * p;
                        d11 = 18.288 * scale;
                        f = 15.875 * scale;
                        l1 = 68.2498 * scale;
                        l2 = 28.448 * scale;
                        l3 = 38.448 * scale;
                        l4 = 4.7752 * scale;
                        l7 = 0.762 * scale;
                        r1 = 1.016 * scale;
                        r2 = (d11 - d2) / 2 / Math.Tan(30 * pi / 180);
                        lpcon = 19.05 * scale;
                        v = 11.1125 * scale;
                        y = 3.175 * scale;
                        x = 7.1882 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;

                    }
                    if (czc == 45)
                    {
                        b = 19.558 * scale;
                        d1 = 57.15 * scale;
                        d2 = 19.4564 * scale;
                        d4 = 74.9046 * scale;
                        df = 82.55 * scale;
                        crks = 20 * scale;
                        p = 1.5 * scale;
                        xj = crks - 1.0825 * p;
                        d11 = 21.59 * scale;
                        f = 15.875 * scale;
                        l1 = 82.55 * scale;
                        l2 = 38.1 * scale;
                        l3 = 48.1 * scale;
                        l4 = 4.7752 * scale;
                        l7 = 0.762 * scale;
                        r1 = 1.016 * scale;
                        r2 = (d11 - d2) / 2 / Math.Tan(30 * pi / 180);
                        lpcon = 19.05 * scale;
                        v = 11.1125 * scale;
                        y = 3.175 * scale;
                        x = 7.1882 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 50)
                    {
                        b = 25.908 * scale;
                        d1 = 69.85 * scale;
                        d2 = 26.1874 * scale;
                        d4 = 91.2876 * scale;
                        df = 98.425 * scale;
                        crks = 24 * scale;
                        p = 1.5 * scale;
                        xj = crks - 1.0825 * p;
                        d11 = 28.575 * scale;
                        f = 15.875 * scale;
                        l1 = 101.6 * scale;
                        l2 = 44.45 * scale;
                        l3 = 54.45 * scale;
                        l4 = 6.35 * scale;
                        l7 = 0.762 * scale;
                        r1 = 1.016 * scale;
                        r2 = (d11 - d2) / 2 / Math.Tan(30 * pi / 180);
                        lpcon = 19.05 * scale;
                        v = 11.1125 * scale;
                        y = 3.175 * scale;
                        x = 7.1882 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 60)
                    {
                        b = 25.908 * scale;
                        d1 = 107.95 * scale;
                        d2 = 32.5374 * scale;
                        d4 = 132.5626 * scale;
                        df = 139.7 * scale;
                        crks = 30 * scale;
                        p = 1.5 * scale;
                        xj = crks - 1.0825 * p;
                        d11 = 34.925 * scale;
                        f = 15.875 * scale;
                        l1 = 161.925 * scale;
                        l2 = 57.15 * scale;
                        l3 = 67.15 * scale;
                        l4 = 7.9248 * scale;
                        l7 = 1.016 * scale;
                        r1 = 1.016 * scale;
                        r2 = (d11 - d2) / 2 / Math.Tan(30 * pi / 180);
                        lpcon = 19.05 * scale;
                        v = 11.1125 * scale;
                        y = 3.175 * scale;
                        x = 7.1882 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                }
                string ccms3 = "ZYL10";//工件侧形状
                string ccms2 = Convert.ToString(data["ccms2"]);//工件侧大小
                if (ccms3 == "ZYL10" && ccms2 == "6")
                {
                    dconws = 6 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 25 * scale;
                    dd3 = 6 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 15 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "8")
                {
                    dconws = 8 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 28 * scale;
                    dd3 = 8 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 20 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "10")
                {
                    dconws = 10 * scale;
                    ll1 = 39 * scale;
                    ll2 = 20 * scale;
                    ll4 = 41 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 35 * scale;
                    dd3 = 10 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 25 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "12")
                {
                    dconws = 12 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 42 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 12 * scale;//沉头
                    bted = 30 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "14")
                {
                    dconws = 14 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 44 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 14 * scale;//沉头
                    bted = 32 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "16")
                {
                    dconws = 16 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 48 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 16 * scale;//沉头
                    bted = 36 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "18")
                {
                    dconws = 18 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 50 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 18 * scale;//沉头
                    bted = 38 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "20")
                {
                    dconws = 20 * scale;
                    ll1 = 49 * scale;
                    ll2 = 25 * scale;
                    ll4 = 51 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 52 * scale;
                    dd3 = 16 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 20 * scale;//沉头
                    bted = 40 * scale;
                    bhta = 25 * pi / 180;
                    lb = 70 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                double isframe = Convert.ToDouble(data["isframe"]);
                //判断锥柄skg
                if (ccms1 == "skg10")
                {
                    //坐标
                    Vector2 v2 = new Vector2(-l1 + (r1 - r1 * Math.Sin(β)), d1 / 2 - l1 * Math.Tan(β) + (r1 - r1 * Math.Sin(β)) * r1 * Math.Tan(β));//机床侧
                    Vector2 v1 = new Vector2(-l1, v2.Y - r1 * Math.Cos(β));
                    Vector2 v3 = new Vector2(0, d1 / 2);
                    Vector2 v4 = new Vector2(y, v3.Y);
                    Vector2 v5 = new Vector2(v4.X, -v4.Y);
                    Vector2 v6 = new Vector2(v3.X, -v3.Y);
                    Vector2 v7 = new Vector2(v2.X, -v2.Y);
                    Vector2 v8 = new Vector2(v1.X, -v1.Y);
                    double l = Math.Sqrt((v2.X - v1.X) * (v2.X - v1.X) + (v2.Y - v1.Y) * (v2.Y - v1.Y));
                    double h = r1 - (Math.Sqrt((r1 * r1) - l * l / 4));
                    //线段
                    LwPolyline Arc1 = new LwPolyline();
                    Arc1.Vertexes.Add(new LwPolylineVertex(v2));
                    Arc1.Vertexes.Add(new LwPolylineVertex(v1));
                    Arc1.Vertexes[0].Bulge = 2 * h / l;
                    fun.PolyFill(dxf, Arc1, 0.3, contour);
                    Vector2[] Line1 = { v2, v3 };
                    fun.drawBLine(dxf, Line1, 0.3, contour);
                    Vector2[] Line2 = { v3, v4 };
                    fun.drawBLine(dxf, Line2, 0.3, contour);
                    Vector2[] Line3 = { v4, v5 };
                    fun.drawBLine(dxf, Line3, 0.3, contour);
                    Vector2[] Line4 = { v5, v6 };
                    fun.drawBLine(dxf, Line4, 0.3, contour);
                    Vector2[] Line5 = { v6, v7 };
                    fun.drawBLine(dxf, Line5, 0.3, contour);
                    LwPolyline Arc2 = new LwPolyline();
                    Arc2.Vertexes.Add(new LwPolylineVertex(v8));
                    Arc2.Vertexes.Add(new LwPolylineVertex(v7));
                    Arc2.Vertexes[0].Bulge = 2 * h / l;
                    fun.PolyFill(dxf, Arc2, 0.3, contour);
                    Vector2[] Line6 = { v8, v1 };
                    fun.drawBLine(dxf, Line6, 0.3, contour);
                    Vector2[] Line7 = { v2, v7 };
                    fun.drawBLine(dxf, Line7, 0.3, contour);
                    Vector2[] Line8 = { v3, v6 };
                    fun.drawBLine(dxf, Line8, 0.3, contour);

                    //坐标
                    Vector2 v82 = new Vector2(v1.X, d11 / 2);//机床侧内部
                    Vector2 v83 = new Vector2(v1.X + r2, d2 / 2);
                    Vector2 v84 = new Vector2(v1.X + l4, v83.Y);
                    Vector2 v85 = new Vector2(v84.X, xj / 2);
                    Vector2 v86 = new Vector2(v1.X + l3, v85.Y);
                    Vector2 v87 = new Vector2(v86.X + 3, 0);
                    Vector2 v88 = new Vector2(v86.X, -v86.Y);
                    Vector2 v89 = new Vector2(v85.X, -v85.Y);
                    Vector2 v90 = new Vector2(v84.X, -v84.Y);
                    Vector2 v91 = new Vector2(v83.X, -v83.Y);
                    Vector2 v92 = new Vector2(v82.X, -v82.Y);
                    Vector2 v93 = new Vector2(v84.X, crks / 2);
                    Vector2 v94 = new Vector2(v84.X + l2, v93.Y);
                    Vector2 v95 = new Vector2(v94.X, -v94.Y);
                    Vector2 v96 = new Vector2(v93.X, -v93.Y);
                    //线段
                    Vector2[] Line9 = { v82, v83 };
                    fun.drawBLine(dxf, Line9, 0.3, contour);
                    Vector2[] Line10 = { v83, v84 };
                    fun.drawBLine(dxf, Line10, 0.3, contour);
                    Vector2[] Line11 = { v84, v85 };
                    fun.drawBLine(dxf, Line11, 0.3, contour);
                    Vector2[] Line12 = { v85, v86 };
                    fun.drawBLine(dxf, Line12, 0.3, contour);
                    Vector2[] Line13 = { v86, v87 };
                    fun.drawBLine(dxf, Line13, 0.3, contour);
                    Vector2[] Line14 = { v87, v88 };
                    fun.drawBLine(dxf, Line14, 0.3, contour);
                    Vector2[] Line42 = { v88, v89 };
                    fun.drawBLine(dxf, Line42, 0.3, contour);
                    Vector2[] Line15 = { v89, v90 };
                    fun.drawBLine(dxf, Line15, 0.3, contour);
                    Vector2[] Line16 = { v90, v91 };
                    fun.drawBLine(dxf, Line16, 0.3, contour);
                    Vector2[] Line17 = { v91, v92 };
                    fun.drawBLine(dxf, Line17, 0.3, contour);
                    Vector2[] Line18 = { v92, v82 };
                    fun.drawBLine(dxf, Line18, 0.3, contour);
                    Vector2[] Line43 = { v83, v91 };
                    fun.drawBLine(dxf, Line43, 0.3, contour);
                    Vector2[] Line44 = { v85, v89 };
                    fun.drawBLine(dxf, Line44, 0.3, contour);
                    Vector2[] Line45 = { v86, v88 };
                    fun.drawBLine(dxf, Line45, 0.3, contour);
                    Vector2[] Line90 = { v93, v94 };
                    fun.drawBLine(dxf, Line90, 0.3, contour);
                    Vector2[] Line91 = { v94, v95 };
                    fun.drawBLine(dxf, Line91, 0.3, contour);
                    Vector2[] Line92 = { v95, v96 };
                    fun.drawBLine(dxf, Line92, 0.3, contour);

                    //坐标
                    Vector2 v9 = new Vector2(y, df / 2 - 1);//法兰外侧
                    Vector2 v10 = new Vector2(y + 1, df / 2);
                    Vector2 v11 = new Vector2(v - x / 2 - (df / 2 - d4 / 2 - r4 / 2) * Math.Tan(β1 / 2), v10.Y);
                    Vector2 v12 = new Vector2(v - x / 2, d4 / 2 + r4 / 2);
                    Vector2 v13 = new Vector2(v12.X + r4 / 2 / Math.Tan(β1 / 2), d4 / 2);
                    Vector2 v14 = new Vector2(v + x / 2 - r4 / 2 / Math.Tan(β1 / 2), v13.Y);
                    Vector2 v15 = new Vector2(v + x / 2, v12.Y);
                    Vector2 v16 = new Vector2(v15.X + (df / 2 - d4 / 2 - r4 / 2) * Math.Tan(β1 / 2), v11.Y);
                    Vector2 v17 = new Vector2(lpcon - 1, v16.Y);
                    Vector2 v18 = new Vector2(lpcon, v16.Y - 1);
                    Vector2 v19 = new Vector2(v9.X, -v9.Y);
                    Vector2 v20 = new Vector2(v10.X, -v10.Y);
                    Vector2 v21 = new Vector2(v11.X, -v11.Y);
                    Vector2 v22 = new Vector2(v12.X, -v12.Y);
                    Vector2 v23 = new Vector2(v13.X, -v13.Y);
                    Vector2 v24 = new Vector2(v14.X, -v14.Y);
                    Vector2 v25 = new Vector2(v15.X, -v15.Y);
                    Vector2 v26 = new Vector2(v16.X, -v16.Y);
                    Vector2 v27 = new Vector2(v17.X, -v17.Y);
                    Vector2 v28 = new Vector2(v18.X, -v18.Y);
                    double ll = Math.Sqrt((v15.X - v14.X) * (v15.X - v14.X) + (v15.Y - v14.Y) * (v15.Y - v14.Y));
                    double hh = r4 - (Math.Sqrt((r4 * r4) - ll * ll / 4));
                    //线段
                    Vector2[] Line19 = { v9, v10 };
                    fun.drawBLine(dxf, Line19, 0.3, contour);
                    Vector2[] Line20 = { v10, v11 };
                    fun.drawBLine(dxf, Line20, 0.3, contour);
                    Vector2[] Line21 = { v11, v12 };
                    fun.drawBLine(dxf, Line21, 0.3, contour);
                    LwPolyline Arc3 = new LwPolyline();
                    Arc3.Vertexes.Add(new LwPolylineVertex(v12));
                    Arc3.Vertexes.Add(new LwPolylineVertex(v13));
                    Arc3.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc3, 0.3, contour);
                    Vector2[] Line22 = { v13, v14 };
                    fun.drawBLine(dxf, Line22, 0.3, contour);
                    LwPolyline Arc4 = new LwPolyline();
                    Arc4.Vertexes.Add(new LwPolylineVertex(v14));
                    Arc4.Vertexes.Add(new LwPolylineVertex(v15));
                    Arc4.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc4, 0.3, contour);
                    Vector2[] Line23 = { v15, v16 };
                    fun.drawBLine(dxf, Line23, 0.3, contour);
                    Vector2[] Line24 = { v16, v17 };
                    fun.drawBLine(dxf, Line24, 0.3, contour);
                    Vector2[] Line25 = { v17, v18 };
                    fun.drawBLine(dxf, Line25, 0.3, contour);
                    Vector2[] Line26 = { v18, v28 };
                    fun.drawBLine(dxf, Line26, 0.3, contour);
                    Vector2[] Line27 = { v28, v27 };
                    fun.drawBLine(dxf, Line27, 0.3, contour);
                    Vector2[] Line28 = { v27, v26 };
                    fun.drawBLine(dxf, Line28, 0.3, contour);
                    Vector2[] Line29 = { v26, v25 };
                    fun.drawBLine(dxf, Line29, 0.3, contour);
                    LwPolyline Arc5 = new LwPolyline();
                    Arc5.Vertexes.Add(new LwPolylineVertex(v25));
                    Arc5.Vertexes.Add(new LwPolylineVertex(v24));
                    Arc5.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc5, 0.3, contour);
                    Vector2[] Line30 = { v24, v23 };
                    fun.drawBLine(dxf, Line30, 0.3, contour);
                    LwPolyline Arc6 = new LwPolyline();
                    Arc6.Vertexes.Add(new LwPolylineVertex(v23));
                    Arc6.Vertexes.Add(new LwPolylineVertex(v22));
                    Arc6.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc6, 0.3, contour);
                    Vector2[] Line31 = { v22, v21 };
                    fun.drawBLine(dxf, Line31, 0.3, contour);
                    Vector2[] Line32 = { v21, v20 };
                    fun.drawBLine(dxf, Line32, 0.3, contour);
                    Vector2[] Line33 = { v20, v19 };
                    fun.drawBLine(dxf, Line33, 0.3, contour);
                    Vector2[] Line34 = { v19, v9 };
                    fun.drawBLine(dxf, Line34, 0.3, contour);

                    //坐标
                    Vector2 v29 = new Vector2(v9.X, b / 2);//法兰内侧
                    Vector2 v30 = new Vector2(v10.X, v29.Y);
                    Vector2 v31 = new Vector2(v11.X, v30.Y);
                    Vector2 v32 = new Vector2(v12.X, v31.Y);
                    Vector2 v33 = new Vector2(v13.X, v32.Y);
                    Vector2 v34 = new Vector2(v14.X, v33.Y);
                    Vector2 v35 = new Vector2(v15.X, v34.Y);
                    Vector2 v36 = new Vector2(v16.X, v35.Y);
                    Vector2 v37 = new Vector2(v17.X, v36.Y);
                    Vector2 v38 = new Vector2(v29.X, v29.Y - l7);
                    Vector2 v39 = new Vector2(v37.X, v37.Y - l7);
                    Vector2 v40 = new Vector2(v29.X, -v29.Y);
                    Vector2 v41 = new Vector2(v30.X, v40.Y);
                    Vector2 v42 = new Vector2(v31.X, v41.Y);
                    Vector2 v43 = new Vector2(v32.X, v42.Y);
                    Vector2 v44 = new Vector2(v33.X, v43.Y);
                    Vector2 v45 = new Vector2(v34.X, v44.Y);
                    Vector2 v46 = new Vector2(v35.X, v45.Y);
                    Vector2 v47 = new Vector2(v36.X, v46.Y);
                    Vector2 v48 = new Vector2(v37.X, v47.Y);
                    Vector2 v49 = new Vector2(v40.X, v40.Y + l7);
                    Vector2 v50 = new Vector2(v39.X, v49.Y);
                    //线段
                    Vector2[] Line35 = { v29, v37 };
                    fun.drawBLine(dxf, Line35, 0.3, contour);
                    Vector2[] Line36 = { v38, v39 };
                    fun.drawBLine(dxf, Line36, 0.3, contour);
                    Vector2[] Line37 = { v40, v48 };
                    fun.drawBLine(dxf, Line37, 0.3, contour);
                    Vector2[] Line38 = { v49, v50 };
                    fun.drawBLine(dxf, Line38, 0.3, contour);
                    Vector2[] Line39 = { v17, v27 };
                    fun.drawBLine(dxf, Line39, 0.3, contour);
                    Vector2[] Line40 = { v10, v30 };
                    fun.drawBLine(dxf, Line40, 0.3, contour);
                    Vector2[] Line41 = { v11, v31 };
                    fun.drawBLine(dxf, Line41, 0.3, contour);
                    Vector2[] Line46 = { v12, v32 };
                    fun.drawBLine(dxf, Line46, 0.3, contour);
                    Vector2[] Line47 = { v13, v33 };
                    fun.drawBLine(dxf, Line47, 0.3, contour);
                    Vector2[] Line48 = { v14, v34 };
                    fun.drawBLine(dxf, Line48, 0.3, contour);
                    Vector2[] Line49 = { v15, v35 };
                    fun.drawBLine(dxf, Line49, 0.3, contour);
                    Vector2[] Line50 = { v16, v36 };
                    fun.drawBLine(dxf, Line50, 0.3, contour);
                    Vector2[] Line51 = { v20, v41 };
                    fun.drawBLine(dxf, Line51, 0.3, contour);
                    Vector2[] Line52 = { v21, v42 };
                    fun.drawBLine(dxf, Line52, 0.3, contour);
                    Vector2[] Line53 = { v22, v43 };
                    fun.drawBLine(dxf, Line53, 0.3, contour);
                    Vector2[] Line54 = { v23, v44 };
                    fun.drawBLine(dxf, Line54, 0.3, contour);
                    Vector2[] Line55 = { v24, v45 };
                    fun.drawBLine(dxf, Line55, 0.3, contour);
                    Vector2[] Line56 = { v25, v46 };
                    fun.drawBLine(dxf, Line56, 0.3, contour);
                    Vector2[] Line57 = { v26, v47 };
                    fun.drawBLine(dxf, Line57, 0.3, contour);
                    //填充
                    LwPolyline hatchpoly1 = new LwPolyline();
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v1));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v2));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v3));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v6));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v87));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v86));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v94));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v93));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v84));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v83));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v82));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v92));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v8));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v7));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v6));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v87));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v88));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v95));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v96));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v90));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v91));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v92));
                    hatchpoly1.IsClosed = true;
                    String[] htype1 = new String[100];
                    Line[] hline1 = new Line[100];
                    int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst1; i++)
                    {
                        htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype1[i] == "Line")
                        {
                            hline1[i] = (Line)hatchpoly1.Explode()[i];
                        }
                    }
                    fun.hatchsubofline(dxf, htype1, hnumst1, 45, 20 * scale, hline1, hatching);
                }
                //工件侧
                if (ccms3 == "ZYL10")
                {
                    //坐标
                    Vector2 v51 = new Vector2(lpcon, bd / 2);//工件侧外侧
                    Vector2 v52 = new Vector2(lpcon + lb - ll2 - ct / 2, v51.Y);
                    Vector2 v55 = new Vector2(lpcon + lb - ll2 + ct / 2, v52.Y);
                    Vector2 v56 = new Vector2(lpcon + lb - (bd - bted) / 2 / Math.Tan(bhta), v52.Y);
                    Vector2 v57 = new Vector2(lpcon + lb, bted / 2);
                    Vector2 v58 = new Vector2(v51.X, -v51.Y);
                    Vector2 v59 = new Vector2(v56.X, -v56.Y);
                    Vector2 v60 = new Vector2(v57.X, -v57.Y);
                    Vector2 v98 = new Vector2(v57.X, v56.Y);
                    //线段
                    Vector2[] Line58 = { v51, v52 };
                    fun.drawBLine(dxf, Line58, 0.3, contour);
                    Vector2[] Line60 = { v55, v56 };
                    fun.drawBLine(dxf, Line60, 0.3, contour);
                    Vector2[] Line61 = { v56, v57 };
                    fun.drawBLine(dxf, Line61, 0.3, contour);
                    Vector2[] Line62 = { v57, v60 };
                    fun.drawBLine(dxf, Line62, 0.3, contour);
                    Vector2[] Line63 = { v60, v59 };
                    fun.drawBLine(dxf, Line63, 0.3, contour);
                    Vector2[] Line64 = { v59, v58 };
                    fun.drawBLine(dxf, Line64, 0.3, contour);
                    Vector2[] Line65 = { v58, v51 };
                    fun.drawBLine(dxf, Line65, 0.3, contour);
                    Line Line93 = new Line(v56, v98);
                    Line93.Layer = dimensioning;
                    dxf.AddEntity(Line93);

                    //坐标
                    Vector2 v61 = new Vector2(v57.X, dconws / 2 + 1);//工件侧内侧
                    Vector2 v62 = new Vector2(v61.X - 1, dconws / 2);
                    Vector2 v63 = new Vector2(v57.X - ll1, v62.Y);
                    Vector2 v64 = new Vector2(v57.X - ll4, v63.Y);
                    Vector2 v65 = new Vector2(v64.X, dconws / 4);
                    Vector2 v66 = new Vector2(v51.X, v65.Y);
                    Vector2 v67 = new Vector2(v61.X, -v61.Y);
                    Vector2 v68 = new Vector2(v62.X, -v62.Y);
                    Vector2 v69 = new Vector2(v63.X, -v63.Y);
                    Vector2 v70 = new Vector2(v64.X, -v64.Y);
                    Vector2 v71 = new Vector2(v65.X, -v65.Y);
                    Vector2 v72 = new Vector2(v66.X, -v66.Y);
                    Vector2 v81 = new Vector2((v69.X + v70.X) / 2, v70.Y);
                    double lll = v63.X - v64.X;
                    double hhh = (v63.X - v64.X) / 2;
                    // 线段
                    Vector2[] Line67 = { v61, v62 };
                    fun.drawBLine(dxf, Line67, 0.3, contour);
                    LwPolyline Arc7 = new LwPolyline();
                    Arc7.Vertexes.Add(new LwPolylineVertex(v63));
                    Arc7.Vertexes.Add(new LwPolylineVertex(v64));
                    Arc7.Vertexes[0].Bulge = 2 * hhh / lll;
                    fun.PolyFill(dxf, Arc7, 0.3, contour);
                    Vector2[] Line70 = { v64, v65 };
                    fun.drawBLine(dxf, Line70, 0.3, contour);
                    Vector2[] Line71 = { v65, v66 };
                    fun.drawBLine(dxf, Line71, 0.3, contour);
                    Vector2[] Line72 = { v66, v72 };
                    fun.drawBLine(dxf, Line72, 0.3, contour);
                    Vector2[] Line73 = { v72, v71 };
                    fun.drawBLine(dxf, Line73, 0.3, contour);
                    Vector2[] Line74 = { v71, v70 };
                    fun.drawBLine(dxf, Line74, 0.3, contour);
                    LwPolyline Arc8 = new LwPolyline();
                    Arc8.Vertexes.Add(new LwPolylineVertex(v70));
                    Arc8.Vertexes.Add(new LwPolylineVertex(v69));
                    Arc8.Vertexes[0].Bulge = 2 * hhh / lll;
                    fun.PolyFill(dxf, Arc8, 0.3, contour);
                    Vector2[] Line76 = { v69, v68 };
                    fun.drawBLine(dxf, Line76, 0.3, contour);
                    Vector2[] Line77 = { v68, v67 };
                    fun.drawBLine(dxf, Line77, 0.3, contour);
                    Vector2[] Line78 = { v67, v61 };
                    fun.drawBLine(dxf, Line78, 0.3, contour);
                    Vector2[] Line79 = { v63, v69 };
                    fun.drawBLine(dxf, Line79, 0.3, contour);
                    Vector2[] Line80 = { v64, v70 };
                    fun.drawBLine(dxf, Line80, 0.3, contour);
                    Vector2[] Line81 = { v62, v68 };
                    fun.drawBLine(dxf, Line81, 0.3, contour);

                    //坐标
                    Vector2 v73 = new Vector2(v52.X, v52.Y - 1 * scale);//螺纹内部
                    Vector2 v74 = new Vector2(lpcon + lb - ll2 - xj2 / 2, v73.Y);
                    Vector2 v75 = new Vector2(lpcon + lb - ll2 - 2.5 * scale, v74.Y);
                    Vector2 v76 = new Vector2(lpcon + lb - ll2 + 2.5 * scale, v75.Y);
                    Vector2 v77 = new Vector2(lpcon + lb - ll2 + xj2 / 2, v76.Y);
                    Vector2 v78 = new Vector2(v55.X, v77.Y);
                    Vector2 v79 = new Vector2(v74.X, v62.Y);
                    Vector2 v80 = new Vector2(v77.X, v62.Y);
                    Vector2 v97 = new Vector2((v79.X + v80.X) / 2, v79.Y + xj2 / 2 / Math.Tan(118 * pi / 180 / 2));
                    double llll = xj2;
                    double hhhh = xj2 / 2 / Math.Tan(118 * pi / 180 / 2);
                    double xx = (v55.X + v52.X) / 2;//圆的x轴坐标
                    double yy = ((v77.X - xx) * (v77.X - xx) - (v55.X - xx) * (v55.X - xx) - v55.Y * v55.Y + v77.Y * v77.Y) / (2 * (v77.Y - v55.Y));//圆的y轴坐标
                    double rr = Math.Sqrt((v77.X - xx) * (v77.X - xx) + (v77.Y - yy) * (v77.Y - yy));//圆的半径
                    double lllll = Math.Sqrt((v55.X - v77.X) * (v55.X - v77.X) + (v55.Y - v77.Y) * (v55.Y - v77.Y));
                    double hhhhh = rr - (Math.Sqrt((rr * rr) - lllll * lllll / 4));
                    //线段
                    Vector2[] Line82 = { v73, v78 };
                    fun.drawBLine(dxf, Line82, 0.3, contour);
                    Vector2[] Line83 = { v74, v79 };
                    fun.drawBLine(dxf, Line83, 0.3, contour);
                    Vector2[] Line86 = { v80, v77 };
                    fun.drawBLine(dxf, Line86, 0.3, contour);
                    Vector2[] Line87 = { v52, v73 };
                    fun.drawBLine(dxf, Line87, 0.3, contour);
                    Vector2[] Line88 = { v55, v78 };
                    fun.drawBLine(dxf, Line88, 0.3, contour);
                    Vector2[] Line68 = { v62, v80 };
                    fun.drawBLine(dxf, Line68, 0.3, contour);
                    Vector2[] Line89 = { v63, v79 };
                    fun.drawBLine(dxf, Line89, 0.3, contour);
                    LwPolyline Arc9 = new LwPolyline();
                    Arc9.Vertexes.Add(new LwPolylineVertex(v79));
                    Arc9.Vertexes.Add(new LwPolylineVertex(v80));
                    Arc9.Vertexes[0].Bulge = 2 * hhhh / llll;
                    fun.PolyFill(dxf, Arc9, 0.3, contour);
                    LwPolyline Arc10 = new LwPolyline();
                    Arc10.Vertexes.Add(new LwPolylineVertex(v52));
                    Arc10.Vertexes.Add(new LwPolylineVertex(v74));
                    Arc10.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                    fun.PolyFill(dxf, Arc10, 0.3, contour);
                    LwPolyline Arc11 = new LwPolyline();
                    Arc11.Vertexes.Add(new LwPolylineVertex(v77));
                    Arc11.Vertexes.Add(new LwPolylineVertex(v55));
                    Arc11.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                    fun.PolyFill(dxf, Arc11, 0.3, contour);
                    //第一区域填充
                    LwPolyline hatchpoly1 = new LwPolyline();
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v73));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v74));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v79));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v63));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v64));
                    hatchpoly1.Vertexes[5].Bulge = 1;
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v65));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v66));
                    hatchpoly1.IsClosed = true;
                    String[] htype1 = new String[100];
                    Line[] hline1 = new Line[100];
                    Arc[] arc1 = new Arc[100];
                    int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst1; i++)
                    {
                        htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype1[i] == "Line")
                        {
                            hline1[i] = (Line)hatchpoly1.Explode()[i];
                        }
                        if (htype1[i] == "Arc")
                        {
                            arc1[i] = (Arc)hatchpoly1.Explode()[i];
                        }
                    }
                    fun.hatchsub1(dxf, htype1, hnumst1, 45, 10 * scale, hline1, arc1, hatching);

                    //第二区域填充
                    LwPolyline hatchpoly2 = new LwPolyline();
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v72));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v71));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v70));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v69));
                    hatchpoly2.Vertexes[2].Bulge = 1;
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v68));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v67));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v60));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v59));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v58));
                    hatchpoly2.IsClosed = true;
                    String[] htype2 = new String[100];
                    Line[] hline2 = new Line[100];
                    Arc[] arc2 = new Arc[100];
                    int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst2; i++)
                    {
                        htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype2[i] == "Line")
                        {
                            hline2[i] = (Line)hatchpoly2.Explode()[i];
                        }
                        if (htype2[i] == "Arc")
                        {
                            arc2[i] = (Arc)hatchpoly2.Explode()[i];
                        }
                    }
                    fun.hatchsub1(dxf, htype2, hnumst2, 45, 10 * scale, hline2, arc2, hatching);
                    //第三区域填充
                    LwPolyline hatchpoly3 = new LwPolyline();
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v77));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v78));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v55));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v56));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v57));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v61));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v62));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                    hatchpoly3.IsClosed = true;
                    String[] htype3 = new String[100];
                    Line[] hline3 = new Line[100];
                    int hnumst3 = hatchpoly3.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst3; i++)
                    {
                        htype3[i] = hatchpoly3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype3[i] == "Line")
                        {
                            hline3[i] = (Line)hatchpoly3.Explode()[i];
                        }
                    }
                    fun.hatchsubofline(dxf, htype3, hnumst3, 45, 5, hline3, hatching);
                    //文本样式
                    DimensionStyle dimensionStyle = fun.CreateDimStyle();
                    dimensionStyle.ArrowSize = 0.2;
                    dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                    dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
                    dimensionStyle.TextHeight = 1.0;
                    double offset = 10;
                    //标注
                    LinearDimension dim1 = new LinearDimension(new Line(new Vector2(-l1, -(d1 / 2 - l1 * Math.Tan(β) + (r1 - r1 * Math.Sin(β)) * r1 * Math.Tan(β) - r1 * Math.Cos(β))), v60), 2 * offset + (v60.Y - (d1 / 2 - l1 * Math.Tan(β) + (r1 - r1 * Math.Sin(β)) * r1 * Math.Tan(β) - r1 * Math.Cos(β))) / 2 + df / 2, 180, dimensionStyle);
                    dim1.UserText = "OAL="+ Math.Round((l1 + lpcon + lb) / scale, 2);
                    dxf.AddEntity(dim1);

                    LinearDimension dim2 = new LinearDimension(new Line(new Vector2(lpcon, -df / 2 + 1), v60), offset + (v60.Y - (-df / 2 + 1)) / 2, 180, dimensionStyle);
                    dim2.UserText = "LB="+ Math.Round(lb / scale, 2);
                    dxf.AddEntity(dim2);

                    LinearDimension dim3 = new LinearDimension(new Line(v81, v60), offset + (v81.Y + v60.Y) / 2 - v58.Y, 180, dimensionStyle);
                    dim3.UserText = "LSC="+ Math.Round(((ll1 + ll4) / 2) / scale, 2);
                    dxf.AddEntity(dim3);

                    LinearDimension dim4 = new LinearDimension(new Line(new Vector2(0, d1 / 2), v57), 4 * offset + df / 2 - 1 - (d1 / 2 + v57.Y) / 2, 0, dimensionStyle);
                    dim4.UserText = "LPR="+ Math.Round((lpcon + lb) / scale, 2);
                    dxf.AddEntity(dim4);

                    LinearDimension dim5 = new LinearDimension(new Line(new Vector2(0, d1 / 2), v97), 3 * offset + df / 2 - 1 - (d1 / 2 + v97.Y) / 2, 0, dimensionStyle);
                    dim5.UserText = "LF="+ Math.Round((lpr - ll2) / scale, 2);
                    dxf.AddEntity(dim5);

                    LinearDimension dim6 = new LinearDimension(new Line(new Vector2(0, d1 / 2), new Vector2(lpcon, df / 2 - 1)), offset + (df / 2 - 1 - d1 / 2) / 2, 0, dimensionStyle);
                    dim6.UserText = "LPCON="+ Math.Round(lpcon / scale, 2);
                    dxf.AddEntity(dim6);

                    Angular2LineDimension dim7 = new Angular2LineDimension(new Line(v56, v98), new Line(v56, v57), offset, dimensionStyle);
                    dim7.UserText = String.Format("BHTA={0}°", bhta / (pi / 180));
                    dxf.AddEntity(dim7);

                    LinearDimension dim8 = new LinearDimension(new Line(new Vector2(-l1 + l4, crks / 2), new Vector2(-l1, -crks / 2)), offset, 90, dimensionStyle);
                    dim8.UserText = "CRKS="+ Math.Round(crks / scale, 2);
                    dxf.AddEntity(dim8);

                    LinearDimension dim9 = new LinearDimension(new Line(new Vector2(lpcon - 1, df / 2), new Vector2(lpcon - 1, -df / 2)), offset, 270, dimensionStyle);
                    dim9.UserText = "DF="+ Math.Round(df / scale, 2);
                    dxf.AddEntity(dim9);

                    LinearDimension dim10 = new LinearDimension(new Line(v56, v59), 3 * offset + (v57.X - v56.X), 270, dimensionStyle);
                    dim10.UserText = "BD="+ Math.Round(bd / scale, 2);
                    dxf.AddEntity(dim10);

                    LinearDimension dim11 = new LinearDimension(new Line(v57, v60), 2 * offset, 270, dimensionStyle);
                    dim11.UserText = "BTED="+ Math.Round(bted / scale, 2);
                    dxf.AddEntity(dim11);

                    LinearDimension dim12 = new LinearDimension(new Line(v62, v68), offset + (v61.X - v62.X), 270, dimensionStyle);
                    dim12.UserText = "DCONWS="+ Math.Round(dconws / scale, 2);
                    dxf.AddEntity(dim12);

                    LinearDimension dim13 = new LinearDimension(new Line(v74, v77), offset, 0, dimensionStyle);
                    dim13.UserText = "DD3="+ Math.Round(dd3 / scale, 2);
                    dxf.AddEntity(dim13);
                    //图框
                    if (isframe == 1)
                    {
                        Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-l1 + oal / 2 - 210, d1 / 2 + 148.5 - d1 / 2));
                        fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                    }
                }
                //文件格式
                dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
                dxf.Save(path);
            }
            if (ccms1 == "skg50")
            {
                double soal = Convert.ToDouble(data["l1"]) + Convert.ToDouble(data["lpcon"]) + Convert.ToDouble(data["lb"]);//总长度
                double scale = Convert.ToDouble(data["scale"]);//比例
                if (scale == 0)
                {
                    if (soal < 53.8)
                    {
                        scale = 5.0;
                    }
                    else if (soal < 67.25)
                    {
                        scale = 4.0;
                    }
                    else if (soal < 90)
                    {
                        scale = 3.0;
                    }
                    else if (soal < 134.5)
                    {
                        scale = 1.5;
                    }
                    else if (soal < 269)
                    {
                        scale = 1.0;
                    }
                    else if (soal < 359)
                    {
                        scale = 0.75;
                    }
                    else
                    {
                        scale = 0.5;
                    }
                }//比例判断
                double lb = Convert.ToDouble(data["lb"]) * scale;//体长
                double lpcon = Convert.ToDouble(data["lpcon"]) * scale;//连接伸出长度
                double lpr = 72 * scale;//伸出长度
                double l1 = Convert.ToDouble(data["l1"]) * scale;
                double oal = 120.4 * scale;//总长度
                                           //法兰
                double v = Convert.ToDouble(data["v"]) * scale;
                double x = Convert.ToDouble(data["x"]) * scale;
                double y = Convert.ToDouble(data["y"]) * scale;
                double r4 = Convert.ToDouble(data["r4"]) * scale;
                double β1 = Convert.ToDouble(data["b1"]) * pi / 180;
                double d4 = Convert.ToDouble(data["d4"]) * scale;
                double f = Convert.ToDouble(data["f"]) * scale;
                //工件侧
                double ll1 = Convert.ToDouble(data["ll1"]) * scale;
                double ll4 = Convert.ToDouble(data["ll4"]) * scale;
                double lsc = 36 * scale; ;//夹紧长度
                double dconws = Convert.ToDouble(data["dconws"]) * scale;//工件侧连接直径
                double bted = Convert.ToDouble(data["bted"]) * scale;//体锥度端径
                double bd = Convert.ToDouble(data["bd"]) * scale;//体直径
                double bhta = Convert.ToDouble(data["bhta"]) * pi / 180;//体半锥角
                double ll2 = Convert.ToDouble(data["ll2"]) * scale;
                double lf = 54 * scale;//功能长度
                double dd3 = Convert.ToDouble(data["dd3"]) * scale;
                double p2 = Convert.ToDouble(data["p2"]) * scale;//螺距
                double xj2 = 7 * scale;//螺纹小径2
                double ct = Convert.ToDouble(data["ct"]) * scale;
                //skg
                double crks = Convert.ToDouble(data["crks"]) * scale;//连接保持旋钮螺纹尺寸
                double p = Convert.ToDouble(data["p"]) * scale;//螺距
                double xj = 13 * scale;//螺纹小径1
                double df = Convert.ToDouble(data["df"]) * scale;//法兰直径
                double czc = Convert.ToDouble(data["czc"]);
                double b = Convert.ToDouble(data["b"]) * scale;
                double d1 = Convert.ToDouble(data["d1"]) * scale;
                double d2 = Convert.ToDouble(data["d2"]) * scale;
                double d11 = Convert.ToDouble(data["d11"]) * scale;
                double l2 = Convert.ToDouble(data["l2"]) * scale;
                double l3 = Convert.ToDouble(data["l3"]) * scale;
                double l4 = Convert.ToDouble(data["l4"]) * scale;
                double l7 = Convert.ToDouble(data["l7"]) * scale;
                double r1 = Convert.ToDouble(data["r1"]) * scale;
                double r2 = Convert.ToDouble(data["r2"]) * scale;
                double β = Convert.ToDouble(data["bb"]) * pi / 180;
                if (ccms1 == "skg50")//机床测1
                {
                    if (czc == 30)
                    {
                        b = 16.1 * scale;
                        d1 = 31.75 * scale;
                        d2 = 12.5 * scale;
                        d4 = 38 * scale;
                        df = 46 * scale;
                        crks = 12 * scale;
                        p = 1.5 * scale;
                        xj = crks - 1.0852 * p;
                        d11 = 14.5 * scale;
                        f = 20 * scale;
                        l1 = 48.4 * scale;
                        l2 = 24 * scale;
                        l3 = 34 * scale;
                        l4 = 7 * scale;
                        l7 = 1.6 * scale;
                        r1 = 0.5 * scale;
                        r2 = 0.8 * scale;
                        lpcon = 22 * scale;
                        v = 13.6 * scale;
                        y = 4 * scale;
                        x = 2 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = (59 + 45 / 60) * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 40)
                    {
                        b = 16.1 * scale;
                        d1 = 44.45 * scale;
                        d2 = 17 * scale;
                        d4 = 53 * scale;
                        df = 63 * scale;
                        crks = 16 * scale;
                        p = 1.5 * scale;
                        xj = crks - 1.0852 * p;
                        d11 = 19 * scale;
                        f = 25 * scale;
                        l1 = 65.4 * scale;
                        l2 = 30 * scale;
                        l3 = 43 * scale;
                        l4 = 9 * scale;
                        l7 = 1.6 * scale;
                        r1 = 1 * scale;
                        r2 = 1 * scale;
                        lpcon = 27 * scale;
                        v = 16.6 * scale;
                        x = 5 * scale;
                        y = 2 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = (59 + 45 / 60) * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 45)
                    {
                        b = 19.3 * scale;
                        d1 = 57.15 * scale;
                        d2 = 21 * scale;
                        d4 = 73 * scale;
                        df = 85 * scale;
                        crks = 20 * scale;
                        p = 1.5 * scale;
                        xj = crks - 1.0852 * p;
                        d11 = 23.5 * scale;
                        f = 30 * scale;
                        l1 = 82.8 * scale;
                        l2 = 36 * scale;
                        l3 = 50 * scale;
                        l4 = 11 * scale;
                        l7 = 1.6 * scale;
                        r1 = 1 * scale;
                        r2 = 1.2 * scale;
                        lpcon = 33 * scale;
                        v = 21.2 * scale;
                        x = 6 * scale;
                        y = 3 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = (59 + 45 / 60) * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 50)
                    {
                        b = 25.7 * scale;
                        d1 = 69.85 * scale;
                        d2 = 25 * scale;
                        d4 = 85 * scale;
                        df = 100 * scale;
                        crks = 24 * scale;
                        p = 1.5 * scale;
                        xj = crks - 1.0852 * p;
                        d11 = 28 * scale;
                        f = 35 * scale;
                        l1 = 101.8 * scale;
                        l2 = 45 * scale;
                        l3 = 62 * scale;
                        l4 = 13 * scale;
                        l7 = 1.6 * scale;
                        r1 = 1 * scale;
                        r2 = 1.5 * scale;
                        lpcon = 38 * scale;
                        v = 23.2 * scale;
                        x = 7 * scale;
                        y = 3 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = (59 + 45 / 60) * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 60)
                    {
                        b = 25.7 * scale;
                        d1 = 107.95 * scale;
                        d2 = 31 * scale;
                        d4 = 135 * scale;
                        df = 155 * scale;
                        crks = 30 * scale;
                        p = 1.5 * scale;
                        xj = crks - 1.0852 * p;
                        d11 = 36 * scale;
                        f = 45 * scale;
                        l1 = 161.8 * scale;
                        l2 = 56 * scale;
                        l3 = 76 * scale;
                        l4 = 16 * scale;
                        l7 = 2 * scale;
                        r1 = 1 * scale;
                        r2 = 2 * scale;
                        lpcon = 48 * scale;
                        v = 28.2 * scale;
                        x = 11 * scale;
                        y = 3 * scale;
                        β = (8 + 17 / 60 + 50 / 3600) * pi / 180;
                        β1 = (59 + 45 / 60) * pi / 180;
                        r4 = 1 * scale;
                    }

                }
                string ccms3 = "ZYL10";//工件侧形状
                string ccms2 = Convert.ToString(data["ccms2"]);//工件侧大小
                if (ccms3 == "ZYL10" && ccms2 == "6")
                {
                    dconws = 6 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 25 * scale;
                    dd3 = 6 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 15 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "8")
                {
                    dconws = 8 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 28 * scale;
                    dd3 = 8 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 20 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "10")
                {
                    dconws = 10 * scale;
                    ll1 = 39 * scale;
                    ll2 = 20 * scale;
                    ll4 = 41 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 35 * scale;
                    dd3 = 10 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 25 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "12")
                {
                    dconws = 12 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 42 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 12 * scale;//沉头
                    bted = 30 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "14")
                {
                    dconws = 14 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 44 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 14 * scale;//沉头
                    bted = 32 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "16")
                {
                    dconws = 16 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 48 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 16 * scale;//沉头
                    bted = 36 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "18")
                {
                    dconws = 18 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 50 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 18 * scale;//沉头
                    bted = 38 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "20")
                {
                    dconws = 20 * scale;
                    ll1 = 49 * scale;
                    ll2 = 25 * scale;
                    ll4 = 51 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 52 * scale;
                    dd3 = 16 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 20 * scale;//沉头
                    bted = 40 * scale;
                    bhta = 25 * pi / 180;
                    lb = 70 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                double isframe = Convert.ToDouble(data["isframe"]);
                //判断锥柄skg
                if (ccms1 == "skg50")
                {
                    //坐标
                    Vector2 v2 = new Vector2(-l1 + (r1 - r1 * Math.Sin(β)), d1 / 2 - l1 * Math.Tan(β) + (r1 - r1 * Math.Sin(β)) * r1 * Math.Tan(β));//机床侧
                    Vector2 v1 = new Vector2(-l1, v2.Y - r1 * Math.Cos(β));
                    Vector2 v3 = new Vector2(0, d1 / 2);
                    Vector2 v4 = new Vector2(y, v3.Y);
                    Vector2 v5 = new Vector2(v4.X, -v4.Y);
                    Vector2 v6 = new Vector2(v3.X, -v3.Y);
                    Vector2 v7 = new Vector2(v2.X, -v2.Y);
                    Vector2 v8 = new Vector2(v1.X, -v1.Y);
                    double l = Math.Sqrt((v2.X - v1.X) * (v2.X - v1.X) + (v2.Y - v1.Y) * (v2.Y - v1.Y));
                    double h = r1 - (Math.Sqrt((r1 * r1) - l * l / 4));
                    //线段
                    LwPolyline Arc1 = new LwPolyline();
                    Arc1.Vertexes.Add(new LwPolylineVertex(v2));
                    Arc1.Vertexes.Add(new LwPolylineVertex(v1));
                    Arc1.Vertexes[0].Bulge = 2 * h / l;
                    fun.PolyFill(dxf, Arc1, 0.3, contour);
                    Vector2[] Line1 = { v2, v3 };
                    fun.drawBLine(dxf, Line1, 0.3, contour);
                    Vector2[] Line2 = { v3, v4 };
                    fun.drawBLine(dxf, Line2, 0.3, contour);
                    Vector2[] Line3 = { v4, v5 };
                    fun.drawBLine(dxf, Line3, 0.3, contour);
                    Vector2[] Line4 = { v5, v6 };
                    fun.drawBLine(dxf, Line4, 0.3, contour);
                    Vector2[] Line5 = { v6, v7 };
                    fun.drawBLine(dxf, Line5, 0.3, contour);
                    LwPolyline Arc2 = new LwPolyline();
                    Arc2.Vertexes.Add(new LwPolylineVertex(v8));
                    Arc2.Vertexes.Add(new LwPolylineVertex(v7));
                    Arc2.Vertexes[0].Bulge = 2 * h / l;
                    fun.PolyFill(dxf, Arc2, 0.3, contour);
                    Vector2[] Line6 = { v8, v1 };
                    fun.drawBLine(dxf, Line6, 0.3, contour);
                    Vector2[] Line7 = { v2, v7 };
                    fun.drawBLine(dxf, Line7, 0.3, contour);
                    Vector2[] Line8 = { v3, v6 };
                    fun.drawBLine(dxf, Line8, 0.3, contour);

                    //坐标
                    Vector2 v82 = new Vector2(v1.X, d11 / 2);//机床侧内部
                    Vector2 v83 = new Vector2(v1.X + r2, d2 / 2);
                    Vector2 v84 = new Vector2(v1.X + l4, v83.Y);
                    Vector2 v85 = new Vector2(v84.X, xj / 2);
                    Vector2 v86 = new Vector2(v1.X + l3, v85.Y);
                    Vector2 v87 = new Vector2(v86.X + 3, 0);
                    Vector2 v88 = new Vector2(v86.X, -v86.Y);
                    Vector2 v89 = new Vector2(v85.X, -v85.Y);
                    Vector2 v90 = new Vector2(v84.X, -v84.Y);
                    Vector2 v91 = new Vector2(v83.X, -v83.Y);
                    Vector2 v92 = new Vector2(v82.X, -v82.Y);
                    Vector2 v93 = new Vector2(v84.X, crks / 2);
                    Vector2 v94 = new Vector2(v84.X + l2, v93.Y);
                    Vector2 v95 = new Vector2(v94.X, -v94.Y);
                    Vector2 v96 = new Vector2(v93.X, -v93.Y);
                    //线段
                    Vector2[] Line9 = { v82, v83 };
                    fun.drawBLine(dxf, Line9, 0.3, contour);
                    Vector2[] Line10 = { v83, v84 };
                    fun.drawBLine(dxf, Line10, 0.3, contour);
                    Vector2[] Line11 = { v84, v85 };
                    fun.drawBLine(dxf, Line11, 0.3, contour);
                    Vector2[] Line12 = { v85, v86 };
                    fun.drawBLine(dxf, Line12, 0.3, contour);
                    Vector2[] Line13 = { v86, v87 };
                    fun.drawBLine(dxf, Line13, 0.3, contour);
                    Vector2[] Line14 = { v87, v88 };
                    fun.drawBLine(dxf, Line14, 0.3, contour);
                    Vector2[] Line42 = { v88, v89 };
                    fun.drawBLine(dxf, Line42, 0.3, contour);
                    Vector2[] Line15 = { v89, v90 };
                    fun.drawBLine(dxf, Line15, 0.3, contour);
                    Vector2[] Line16 = { v90, v91 };
                    fun.drawBLine(dxf, Line16, 0.3, contour);
                    Vector2[] Line17 = { v91, v92 };
                    fun.drawBLine(dxf, Line17, 0.3, contour);
                    Vector2[] Line18 = { v92, v82 };
                    fun.drawBLine(dxf, Line18, 0.3, contour);
                    Vector2[] Line43 = { v83, v91 };
                    fun.drawBLine(dxf, Line43, 0.3, contour);
                    Vector2[] Line44 = { v85, v89 };
                    fun.drawBLine(dxf, Line44, 0.3, contour);
                    Vector2[] Line45 = { v86, v88 };
                    fun.drawBLine(dxf, Line45, 0.3, contour);
                    Vector2[] Line90 = { v93, v94 };
                    fun.drawBLine(dxf, Line90, 0.3, contour);
                    Vector2[] Line91 = { v94, v95 };
                    fun.drawBLine(dxf, Line91, 0.3, contour);
                    Vector2[] Line92 = { v95, v96 };
                    fun.drawBLine(dxf, Line92, 0.3, contour);

                    //坐标
                    Vector2 v9 = new Vector2(y, df / 2 - 1);//法兰外侧
                    Vector2 v10 = new Vector2(y + 1, df / 2);
                    Vector2 v11 = new Vector2(v - x / 2 - (df / 2 - d4 / 2 - r4 / 2) * Math.Tan(β1 / 2), v10.Y);
                    Vector2 v12 = new Vector2(v - x / 2, d4 / 2 + r4 / 2);
                    Vector2 v13 = new Vector2(v12.X + r4 / 2 / Math.Tan(β1 / 2), d4 / 2);
                    Vector2 v14 = new Vector2(v + x / 2 - r4 / 2 / Math.Tan(β1 / 2), v13.Y);
                    Vector2 v15 = new Vector2(v + x / 2, v12.Y);
                    Vector2 v16 = new Vector2(v15.X + (df / 2 - d4 / 2 - r4 / 2) * Math.Tan(β1 / 2), v11.Y);
                    Vector2 v17 = new Vector2(lpcon - 1, v16.Y);
                    Vector2 v18 = new Vector2(lpcon, v16.Y - 1);
                    Vector2 v19 = new Vector2(v9.X, -v9.Y);
                    Vector2 v20 = new Vector2(v10.X, -v10.Y);
                    Vector2 v21 = new Vector2(v11.X, -v11.Y);
                    Vector2 v22 = new Vector2(v12.X, -v12.Y);
                    Vector2 v23 = new Vector2(v13.X, -v13.Y);
                    Vector2 v24 = new Vector2(v14.X, -v14.Y);
                    Vector2 v25 = new Vector2(v15.X, -v15.Y);
                    Vector2 v26 = new Vector2(v16.X, -v16.Y);
                    Vector2 v27 = new Vector2(v17.X, -v17.Y);
                    Vector2 v28 = new Vector2(v18.X, -v18.Y);
                    double ll = Math.Sqrt((v15.X - v14.X) * (v15.X - v14.X) + (v15.Y - v14.Y) * (v15.Y - v14.Y));
                    double hh = r4 - (Math.Sqrt((r4 * r4) - ll * ll / 4));
                    //线段
                    Vector2[] Line19 = { v9, v10 };
                    fun.drawBLine(dxf, Line19, 0.3, contour);
                    Vector2[] Line20 = { v10, v11 };
                    fun.drawBLine(dxf, Line20, 0.3, contour);
                    Vector2[] Line21 = { v11, v12 };
                    fun.drawBLine(dxf, Line21, 0.3, contour);
                    LwPolyline Arc3 = new LwPolyline();
                    Arc3.Vertexes.Add(new LwPolylineVertex(v12));
                    Arc3.Vertexes.Add(new LwPolylineVertex(v13));
                    Arc3.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc3, 0.3, contour);
                    Vector2[] Line22 = { v13, v14 };
                    fun.drawBLine(dxf, Line22, 0.3, contour);
                    LwPolyline Arc4 = new LwPolyline();
                    Arc4.Vertexes.Add(new LwPolylineVertex(v14));
                    Arc4.Vertexes.Add(new LwPolylineVertex(v15));
                    Arc4.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc4, 0.3, contour);
                    Vector2[] Line23 = { v15, v16 };
                    fun.drawBLine(dxf, Line23, 0.3, contour);
                    Vector2[] Line24 = { v16, v17 };
                    fun.drawBLine(dxf, Line24, 0.3, contour);
                    Vector2[] Line25 = { v17, v18 };
                    fun.drawBLine(dxf, Line25, 0.3, contour);
                    Vector2[] Line26 = { v18, v28 };
                    fun.drawBLine(dxf, Line26, 0.3, contour);
                    Vector2[] Line27 = { v28, v27 };
                    fun.drawBLine(dxf, Line27, 0.3, contour);
                    Vector2[] Line28 = { v27, v26 };
                    fun.drawBLine(dxf, Line28, 0.3, contour);
                    Vector2[] Line29 = { v26, v25 };
                    fun.drawBLine(dxf, Line29, 0.3, contour);
                    LwPolyline Arc5 = new LwPolyline();
                    Arc5.Vertexes.Add(new LwPolylineVertex(v25));
                    Arc5.Vertexes.Add(new LwPolylineVertex(v24));
                    Arc5.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc5, 0.3, contour);
                    Vector2[] Line30 = { v24, v23 };
                    fun.drawBLine(dxf, Line30, 0.3, contour);
                    LwPolyline Arc6 = new LwPolyline();
                    Arc6.Vertexes.Add(new LwPolylineVertex(v23));
                    Arc6.Vertexes.Add(new LwPolylineVertex(v22));
                    Arc6.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc6, 0.3, contour);
                    Vector2[] Line31 = { v22, v21 };
                    fun.drawBLine(dxf, Line31, 0.3, contour);
                    Vector2[] Line32 = { v21, v20 };
                    fun.drawBLine(dxf, Line32, 0.3, contour);
                    Vector2[] Line33 = { v20, v19 };
                    fun.drawBLine(dxf, Line33, 0.3, contour);
                    Vector2[] Line34 = { v19, v9 };
                    fun.drawBLine(dxf, Line34, 0.3, contour);

                    //坐标
                    Vector2 v29 = new Vector2(v9.X, b / 2);//法兰内侧
                    Vector2 v30 = new Vector2(v10.X, v29.Y);
                    Vector2 v31 = new Vector2(v11.X, v30.Y);
                    Vector2 v32 = new Vector2(v12.X, v31.Y);
                    Vector2 v33 = new Vector2(v13.X, v32.Y);
                    Vector2 v34 = new Vector2(v14.X, v33.Y);
                    Vector2 v35 = new Vector2(v15.X, v34.Y);
                    Vector2 v36 = new Vector2(v16.X, v35.Y);
                    Vector2 v37 = new Vector2(v17.X, v36.Y);
                    Vector2 v38 = new Vector2(v29.X, v29.Y - l7);
                    Vector2 v39 = new Vector2(v32.X, v37.Y - l7);
                    Vector2 v40 = new Vector2(v29.X, -v29.Y);
                    Vector2 v41 = new Vector2(v30.X, v40.Y);
                    Vector2 v42 = new Vector2(v31.X, v41.Y);
                    Vector2 v43 = new Vector2(v32.X, v42.Y);
                    Vector2 v44 = new Vector2(v33.X, v43.Y);
                    Vector2 v45 = new Vector2(v34.X, v44.Y);
                    Vector2 v46 = new Vector2(v35.X, v45.Y);
                    Vector2 v47 = new Vector2(v36.X, v46.Y);
                    Vector2 v48 = new Vector2(v37.X, v47.Y);
                    Vector2 v49 = new Vector2(v40.X, v40.Y + l7);
                    Vector2 v50 = new Vector2(v39.X, v49.Y);
                    //线段
                    Vector2[] Line35 = { v29, v37 };
                    fun.drawBLine(dxf, Line35, 0.3, contour);
                    Vector2[] Line36 = { v38, v39 };
                    fun.drawBLine(dxf, Line36, 0.3, contour);
                    Vector2[] Line37 = { v40, v48 };
                    fun.drawBLine(dxf, Line37, 0.3, contour);
                    Vector2[] Line38 = { v49, v50 };
                    fun.drawBLine(dxf, Line38, 0.3, contour);
                    Vector2[] Line39 = { v17, v27 };
                    fun.drawBLine(dxf, Line39, 0.3, contour);
                    Vector2[] Line40 = { v10, v30 };
                    fun.drawBLine(dxf, Line40, 0.3, contour);
                    Vector2[] Line41 = { v11, v31 };
                    fun.drawBLine(dxf, Line41, 0.3, contour);
                    Vector2[] Line46 = { v12, v32 };
                    fun.drawBLine(dxf, Line46, 0.3, contour);
                    Vector2[] Line47 = { v13, v33 };
                    fun.drawBLine(dxf, Line47, 0.3, contour);
                    Vector2[] Line48 = { v14, v34 };
                    fun.drawBLine(dxf, Line48, 0.3, contour);
                    Vector2[] Line49 = { v15, v35 };
                    fun.drawBLine(dxf, Line49, 0.3, contour);
                    Vector2[] Line50 = { v16, v36 };
                    fun.drawBLine(dxf, Line50, 0.3, contour);
                    Vector2[] Line51 = { v20, v41 };
                    fun.drawBLine(dxf, Line51, 0.3, contour);
                    Vector2[] Line52 = { v21, v42 };
                    fun.drawBLine(dxf, Line52, 0.3, contour);
                    Vector2[] Line53 = { v22, v43 };
                    fun.drawBLine(dxf, Line53, 0.3, contour);
                    Vector2[] Line54 = { v23, v44 };
                    fun.drawBLine(dxf, Line54, 0.3, contour);
                    Vector2[] Line55 = { v24, v45 };
                    fun.drawBLine(dxf, Line55, 0.3, contour);
                    Vector2[] Line56 = { v25, v46 };
                    fun.drawBLine(dxf, Line56, 0.3, contour);
                    Vector2[] Line57 = { v26, v47 };
                    fun.drawBLine(dxf, Line57, 0.3, contour);
                    LwPolyline Arc10 = new LwPolyline();
                    Arc10.Vertexes.Add(new LwPolylineVertex(v50));
                    Arc10.Vertexes.Add(new LwPolylineVertex(v39));
                    Arc10.Vertexes[0].Bulge = (b - 2 * l7) / (b - 2 * l7);
                    fun.PolyFill(dxf, Arc10, 0.3, contour);
                    //填充
                    LwPolyline hatchpoly1 = new LwPolyline();
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v1));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v2));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v3));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v6));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v87));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v86));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v94));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v93));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v84));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v83));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v82));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v92));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v8));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v7));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v6));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v87));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v88));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v95));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v96));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v90));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v91));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v92));
                    hatchpoly1.IsClosed = true;
                    String[] htype1 = new String[100];
                    Line[] hline1 = new Line[100];
                    int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst1; i++)
                    {
                        htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype1[i] == "Line")
                        {
                            hline1[i] = (Line)hatchpoly1.Explode()[i];
                        }
                    }
                    fun.hatchsubofline(dxf, htype1, hnumst1, 45, 20 * scale, hline1, hatching);
                }
                //工件侧
                if (ccms3 == "ZYL10")
                {
                    //坐标
                    Vector2 v51 = new Vector2(lpcon, bd / 2);//工件侧外侧
                    Vector2 v52 = new Vector2(lpcon + lb - ll2 - ct / 2, v51.Y);
                    Vector2 v55 = new Vector2(lpcon + lb - ll2 + ct / 2, v52.Y);
                    Vector2 v56 = new Vector2(lpcon + lb - (bd - bted) / 2 / Math.Tan(bhta), v52.Y);
                    Vector2 v57 = new Vector2(lpcon + lb, bted / 2);
                    Vector2 v58 = new Vector2(v51.X, -v51.Y);
                    Vector2 v59 = new Vector2(v56.X, -v56.Y);
                    Vector2 v60 = new Vector2(v57.X, -v57.Y);
                    Vector2 v98 = new Vector2(v57.X, v56.Y);
                    //线段
                    Vector2[] Line58 = { v51, v52 };
                    fun.drawBLine(dxf, Line58, 0.3, contour);
                    Vector2[] Line60 = { v55, v56 };
                    fun.drawBLine(dxf, Line60, 0.3, contour);
                    Vector2[] Line61 = { v56, v57 };
                    fun.drawBLine(dxf, Line61, 0.3, contour);
                    Vector2[] Line62 = { v57, v60 };
                    fun.drawBLine(dxf, Line62, 0.3, contour);
                    Vector2[] Line63 = { v60, v59 };
                    fun.drawBLine(dxf, Line63, 0.3, contour);
                    Vector2[] Line64 = { v59, v58 };
                    fun.drawBLine(dxf, Line64, 0.3, contour);
                    Vector2[] Line65 = { v58, v51 };
                    fun.drawBLine(dxf, Line65, 0.3, contour);
                    Line Line93 = new Line(v56, v98);
                    Line93.Layer = dimensioning;
                    dxf.AddEntity(Line93);

                    //坐标
                    Vector2 v61 = new Vector2(v57.X, dconws / 2 + 1);//工件侧内侧
                    Vector2 v62 = new Vector2(v61.X - 1, dconws / 2);
                    Vector2 v63 = new Vector2(v57.X - ll1, v62.Y);
                    Vector2 v64 = new Vector2(v57.X - ll4, v63.Y);
                    Vector2 v65 = new Vector2(v64.X, dconws / 4);
                    Vector2 v66 = new Vector2(v51.X, v65.Y);
                    Vector2 v67 = new Vector2(v61.X, -v61.Y);
                    Vector2 v68 = new Vector2(v62.X, -v62.Y);
                    Vector2 v69 = new Vector2(v63.X, -v63.Y);
                    Vector2 v70 = new Vector2(v64.X, -v64.Y);
                    Vector2 v71 = new Vector2(v65.X, -v65.Y);
                    Vector2 v72 = new Vector2(v66.X, -v66.Y);
                    Vector2 v81 = new Vector2((v69.X + v70.X) / 2, v70.Y);
                    double lll = v63.X - v64.X;
                    double hhh = (v63.X - v64.X) / 2;
                    // 线段
                    Vector2[] Line67 = { v61, v62 };
                    fun.drawBLine(dxf, Line67, 0.3, contour);
                    LwPolyline Arc7 = new LwPolyline();
                    Arc7.Vertexes.Add(new LwPolylineVertex(v63));
                    Arc7.Vertexes.Add(new LwPolylineVertex(v64));
                    Arc7.Vertexes[0].Bulge = 2 * hhh / lll;
                    fun.PolyFill(dxf, Arc7, 0.3, contour);
                    Vector2[] Line70 = { v64, v65 };
                    fun.drawBLine(dxf, Line70, 0.3, contour);
                    Vector2[] Line71 = { v65, v66 };
                    fun.drawBLine(dxf, Line71, 0.3, contour);
                    Vector2[] Line72 = { v66, v72 };
                    fun.drawBLine(dxf, Line72, 0.3, contour);
                    Vector2[] Line73 = { v72, v71 };
                    fun.drawBLine(dxf, Line73, 0.3, contour);
                    Vector2[] Line74 = { v71, v70 };
                    fun.drawBLine(dxf, Line74, 0.3, contour);
                    LwPolyline Arc8 = new LwPolyline();
                    Arc8.Vertexes.Add(new LwPolylineVertex(v70));
                    Arc8.Vertexes.Add(new LwPolylineVertex(v69));
                    Arc8.Vertexes[0].Bulge = 2 * hhh / lll;
                    fun.PolyFill(dxf, Arc8, 0.3, contour);
                    Vector2[] Line76 = { v69, v68 };
                    fun.drawBLine(dxf, Line76, 0.3, contour);
                    Vector2[] Line77 = { v68, v67 };
                    fun.drawBLine(dxf, Line77, 0.3, contour);
                    Vector2[] Line78 = { v67, v61 };
                    fun.drawBLine(dxf, Line78, 0.3, contour);
                    Vector2[] Line79 = { v63, v69 };
                    fun.drawBLine(dxf, Line79, 0.3, contour);
                    Vector2[] Line80 = { v64, v70 };
                    fun.drawBLine(dxf, Line80, 0.3, contour);
                    Vector2[] Line81 = { v62, v68 };
                    fun.drawBLine(dxf, Line81, 0.3, contour);

                    //坐标
                    Vector2 v73 = new Vector2(v52.X, v52.Y - 1 * scale);//螺纹内部
                    Vector2 v74 = new Vector2(lpcon + lb - ll2 - xj2 / 2, v73.Y);
                    Vector2 v75 = new Vector2(lpcon + lb - ll2 - 2.5 * scale, v74.Y);
                    Vector2 v76 = new Vector2(lpcon + lb - ll2 + 2.5 * scale, v75.Y);
                    Vector2 v77 = new Vector2(lpcon + lb - ll2 + xj2 / 2, v76.Y);
                    Vector2 v78 = new Vector2(v55.X, v77.Y);
                    Vector2 v79 = new Vector2(v74.X, v62.Y);
                    Vector2 v80 = new Vector2(v77.X, v62.Y);
                    Vector2 v97 = new Vector2((v79.X + v80.X) / 2, v79.Y + xj2 / 2 / Math.Tan(118 * pi / 180 / 2));
                    double llll = xj2;
                    double hhhh = xj2 / 2 / Math.Tan(118 * pi / 180 / 2);
                    double xx = (v55.X + v52.X) / 2;//圆的x轴坐标
                    double yy = ((v77.X - xx) * (v77.X - xx) - (v55.X - xx) * (v55.X - xx) - v55.Y * v55.Y + v77.Y * v77.Y) / (2 * (v77.Y - v55.Y));//圆的y轴坐标
                    double rr = Math.Sqrt((v77.X - xx) * (v77.X - xx) + (v77.Y - yy) * (v77.Y - yy));//圆的半径
                    double lllll = Math.Sqrt((v55.X - v77.X) * (v55.X - v77.X) + (v55.Y - v77.Y) * (v55.Y - v77.Y));
                    double hhhhh = rr - (Math.Sqrt((rr * rr) - lllll * lllll / 4));
                    //线段
                    Vector2[] Line82 = { v73, v78 };
                    fun.drawBLine(dxf, Line82, 0.3, contour);
                    Vector2[] Line83 = { v74, v79 };
                    fun.drawBLine(dxf, Line83, 0.3, contour);
                    Vector2[] Line86 = { v80, v77 };
                    fun.drawBLine(dxf, Line86, 0.3, contour);
                    Vector2[] Line87 = { v52, v73 };
                    fun.drawBLine(dxf, Line87, 0.3, contour);
                    Vector2[] Line88 = { v55, v78 };
                    fun.drawBLine(dxf, Line88, 0.3, contour);
                    Vector2[] Line68 = { v62, v80 };
                    fun.drawBLine(dxf, Line68, 0.3, contour);
                    Vector2[] Line89 = { v63, v79 };
                    fun.drawBLine(dxf, Line89, 0.3, contour);
                    LwPolyline Arc9 = new LwPolyline();
                    Arc9.Vertexes.Add(new LwPolylineVertex(v79));
                    Arc9.Vertexes.Add(new LwPolylineVertex(v80));
                    Arc9.Vertexes[0].Bulge = 2 * hhhh / llll;
                    fun.PolyFill(dxf, Arc9, 0.3, contour);
                    LwPolyline Arc10 = new LwPolyline();
                    Arc10.Vertexes.Add(new LwPolylineVertex(v52));
                    Arc10.Vertexes.Add(new LwPolylineVertex(v74));
                    Arc10.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                    fun.PolyFill(dxf, Arc10, 0.3, contour);
                    LwPolyline Arc11 = new LwPolyline();
                    Arc11.Vertexes.Add(new LwPolylineVertex(v77));
                    Arc11.Vertexes.Add(new LwPolylineVertex(v55));
                    Arc11.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                    fun.PolyFill(dxf, Arc11, 0.3, contour);
                    //第一区域填充
                    LwPolyline hatchpoly1 = new LwPolyline();
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v73));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v74));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v79));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v63));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v64));
                    hatchpoly1.Vertexes[5].Bulge = 1;
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v65));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v66));
                    hatchpoly1.IsClosed = true;
                    String[] htype1 = new String[100];
                    Line[] hline1 = new Line[100];
                    Arc[] arc1 = new Arc[100];
                    int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst1; i++)
                    {
                        htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype1[i] == "Line")
                        {
                            hline1[i] = (Line)hatchpoly1.Explode()[i];
                        }
                        if (htype1[i] == "Arc")
                        {
                            arc1[i] = (Arc)hatchpoly1.Explode()[i];
                        }
                    }
                    fun.hatchsub1(dxf, htype1, hnumst1, 45, 10 * scale, hline1, arc1, hatching);

                    //第二区域填充
                    LwPolyline hatchpoly2 = new LwPolyline();
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v72));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v71));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v70));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v69));
                    hatchpoly2.Vertexes[2].Bulge = 1;
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v68));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v67));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v60));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v59));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v58));
                    hatchpoly2.IsClosed = true;
                    String[] htype2 = new String[100];
                    Line[] hline2 = new Line[100];
                    Arc[] arc2 = new Arc[100];
                    int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst2; i++)
                    {
                        htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype2[i] == "Line")
                        {
                            hline2[i] = (Line)hatchpoly2.Explode()[i];
                        }
                        if (htype2[i] == "Arc")
                        {
                            arc2[i] = (Arc)hatchpoly2.Explode()[i];
                        }
                    }
                    fun.hatchsub1(dxf, htype2, hnumst2, 45, 10 * scale, hline2, arc2, hatching);
                    //第三区域填充
                    LwPolyline hatchpoly3 = new LwPolyline();
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v77));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v78));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v55));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v56));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v57));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v61));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v62));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                    hatchpoly3.IsClosed = true;
                    String[] htype3 = new String[100];
                    Line[] hline3 = new Line[100];
                    int hnumst3 = hatchpoly3.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst3; i++)
                    {
                        htype3[i] = hatchpoly3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype3[i] == "Line")
                        {
                            hline3[i] = (Line)hatchpoly3.Explode()[i];
                        }
                    }
                    fun.hatchsubofline(dxf, htype3, hnumst3, 45, 5, hline3, hatching);
                    //文本样式
                    DimensionStyle dimensionStyle = fun.CreateDimStyle();
                    dimensionStyle.ArrowSize = 0.2;
                    dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                    dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
                    dimensionStyle.TextHeight = 1.0;
                    double offset = 10;
                    //标注
                    LinearDimension dim1 = new LinearDimension(new Line(new Vector2(-l1, -(d1 / 2 - l1 * Math.Tan(β) + (r1 - r1 * Math.Sin(β)) * r1 * Math.Tan(β) - r1 * Math.Cos(β))), v60), 3 * offset + (-(d1 / 2 - l1 * Math.Tan(β) + (r1 - r1 * Math.Sin(β)) * r1 * Math.Tan(β) - r1 * Math.Cos(β)) + v60.Y) / 2 - (-df / 2), 180, dimensionStyle);
                    dim1.UserText = "OAL="+ Math.Round((l1 + lpcon + lb) / scale, 2);
                    dxf.AddEntity(dim1);

                    LinearDimension dim2 = new LinearDimension(new Line(new Vector2(lpcon, -df / 2 + 1), v60), offset + (v60.Y - (-df / 2 + 1)) / 2, 180, dimensionStyle);
                    dim2.UserText = "LB="+ Math.Round(lb / scale, 2);
                    dxf.AddEntity(dim2);

                    LinearDimension dim3 = new LinearDimension(new Line(v81, v60), offset + (v81.Y + v60.Y) / 2 - v58.Y, 180, dimensionStyle);
                    dim3.UserText = "LSC="+ Math.Round(((ll1 + ll4) / 2) / scale, 2);
                    dxf.AddEntity(dim3);

                    LinearDimension dim4 = new LinearDimension(new Line(new Vector2(0, d1 / 2), v57), 4 * offset + df / 2 - (v57.Y + d1 / 2) / 2, 0, dimensionStyle);
                    dim4.UserText = "LPR="+ Math.Round((lpcon + lb) / scale, 2);
                    dxf.AddEntity(dim4);

                    LinearDimension dim5 = new LinearDimension(new Line(new Vector2(0, d1 / 2), v97), 3 * offset + df / 2 - (v97.Y + d1 / 2) / 2, 0, dimensionStyle);
                    dim5.UserText = "LF="+ Math.Round((lpr - ll2) / scale, 2);
                    dxf.AddEntity(dim5);

                    LinearDimension dim6 = new LinearDimension(new Line(new Vector2(0, d1 / 2), new Vector2(lpcon, df / 2 - 1)), offset + df / 2 - d1 / 2, 0, dimensionStyle);
                    dim6.UserText = "LPCON="+ Math.Round(lpcon / scale, 2);
                    dxf.AddEntity(dim6);

                    Angular2LineDimension dim7 = new Angular2LineDimension(new Line(v56, v98), new Line(v56, v57), offset, dimensionStyle);
                    dim7.UserText = String.Format("BHTA={0}°", bhta / (pi / 180));
                    dxf.AddEntity(dim7);

                    LinearDimension dim8 = new LinearDimension(new Line(new Vector2(-l1 + l4, crks / 2), new Vector2(-l1, -crks / 2)), offset, 90, dimensionStyle);
                    dim8.UserText = "CRKS="+ Math.Round(crks / scale, 2);
                    dxf.AddEntity(dim8);

                    LinearDimension dim9 = new LinearDimension(new Line(new Vector2(lpcon - 1, df / 2), new Vector2(lpcon - 1, -df / 2)), offset, 270, dimensionStyle);
                    dim9.UserText = "DF="+ Math.Round(df / scale, 2);
                    dxf.AddEntity(dim9);

                    LinearDimension dim10 = new LinearDimension(new Line(v56, v59), 3 * offset + v57.X - v56.X, 270, dimensionStyle);
                    dim10.UserText = "BD="+ Math.Round(bd / scale, 2);
                    dxf.AddEntity(dim10);

                    LinearDimension dim11 = new LinearDimension(new Line(v57, v60), 2 * offset, 270, dimensionStyle);
                    dim11.UserText = "BTED="+ Math.Round(bted / scale, 2);
                    dxf.AddEntity(dim11);

                    LinearDimension dim12 = new LinearDimension(new Line(v62, v68), offset + v61.X - v62.X, 270, dimensionStyle);
                    dim12.UserText = "DCONWS="+ Math.Round(dconws / scale, 2);
                    dxf.AddEntity(dim12);

                    LinearDimension dim13 = new LinearDimension(new Line(v74, v77), offset, 0, dimensionStyle);
                    dim13.UserText = "DD3="+ Math.Round(dd3 / scale, 2);
                    dxf.AddEntity(dim13);
                    //图框
                    if (isframe == 1)
                    {
                        Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-l1 + oal / 2 - 210, d1 / 2 + 148.5 - d1 / 2));
                        fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                    }
                }
                //文件格式
                dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
                dxf.Save(path);
            }
            if (ccms1 == "skg20")
            {
                double soal = Convert.ToDouble(data["dl"]) + Convert.ToDouble(data["lpcon"]) + Convert.ToDouble(data["lb"]);//总长度
                double scale = Convert.ToDouble(data["scale"]);//比例
                if (scale == 0)
                {
                    if (soal < 53.8)
                    {
                        scale = 5.0;
                    }
                    else if (soal < 67.25)
                    {
                        scale = 4.0;
                    }
                    else if (soal < 90)
                    {
                        scale = 3.0;
                    }
                    else if (soal < 134.5)
                    {
                        scale = 1.5;
                    }
                    else if (soal < 269)
                    {
                        scale = 1.0;
                    }
                    else if (soal < 359)
                    {
                        scale = 0.75;
                    }
                    else
                    {
                        scale = 0.5;
                    }
                }//比例判断
                 //skg20
                double crks = Convert.ToDouble(data["crks"]) * scale;//连接保持旋钮螺纹尺寸
                double p = Convert.ToDouble(data["p"]) * scale;//螺距
                double xj = crks - 1.0852 * p;//螺纹小径1
                double xd1 = Convert.ToDouble(data["xd1"]) * scale;
                double d2 = Convert.ToDouble(data["d2"]) * scale;
                double d3 = Convert.ToDouble(data["d3"]) * scale;
                double d4 = Convert.ToDouble(data["d4"]) * scale;
                double d1 = Convert.ToDouble(data["d1"]) * scale;//大D1 skg20大直径
                double l3 = Convert.ToDouble(data["l3"]) * scale;
                double l2 = Convert.ToDouble(data["l2"]) * scale;
                double l5 = Convert.ToDouble(data["l5"]) * scale;
                double pp = Convert.ToDouble(data["pp"]) * scale;//槽
                double l1 = Convert.ToDouble(data["l1"]) * scale;//skg20长度
                double l4 = Convert.ToDouble(data["l4"]) * scale;
                double dl = Convert.ToDouble(data["dl"]) * scale;//大L skg长度
                double yyy = Convert.ToDouble(data["yyy"]) * scale;//连接距离
                double lpcon = Convert.ToDouble(data["lpcon"]) * scale;//连接伸出长度
                //法兰
                double df = Convert.ToDouble(data["df"]) * scale;//法兰直径
                double b = Convert.ToDouble(data["b"]) * scale;
                double t = Convert.ToDouble(data["t"]) * scale;
                double k = Convert.ToDouble(data["k"]) * scale;//法兰宽度
                //工件侧
                double lb = Convert.ToDouble(data["lb"]) * scale;//体长
                double lpr = lpcon + lb;//伸出长度
                double oal = dl + lpr;//总长度
                double ll1 = Convert.ToDouble(data["ll1"]) * scale;
                double ll4 = Convert.ToDouble(data["ll4"]) * scale;
                double lsc = (ll1 + ll4) / 2;//夹紧长度
                double dconws = Convert.ToDouble(data["dconws"]) * scale;//工件侧连接直径
                double bted = Convert.ToDouble(data["bted"]) * scale;//体锥度端径
                double bd = Convert.ToDouble(data["bd"]) * scale;//体直径
                double bhta = Convert.ToDouble(data["bhta"]) * pi / 180;//体半锥角
                double ll2 = Convert.ToDouble(data["ll2"]) * scale;
                double lf = lpr - ll2;//功能长度
                double dd3 = Convert.ToDouble(data["dd3"]) * scale;
                double p2 = Convert.ToDouble(data["p2"]) * scale;//螺距
                double xj2 = 7 * scale;//螺纹小径2
                double ct = Convert.ToDouble(data["ct"]) * scale;
                double czc = Convert.ToDouble(data["czc"]);
                if (ccms1 == "skg20")
                {
                    if (czc == 30)
                    {
                        xd1 = 17.4 * scale;
                        d2 = 13 * scale;
                        d3 = 16.5 * scale;
                        d4 = 16 * scale;
                        crks = 12 * scale;
                        d1 = 31.75 * scale;
                        l3 = 34 * scale;
                        l2 = 24 * scale;
                        l5 = 5.5 * scale;
                        pp = 3 * scale;
                        l1 = 48.4 * scale;
                        l4 = 62.9 * scale;
                        dl = 68.4 * scale;
                        yyy = 1.6 * scale;
                        b = 16.1 * scale;
                        t = 16.2 * scale;
                        k = 8 * scale;
                        df = 50 * scale;
                        lpcon = 9.6 * scale;//连接伸出长度
                    }
                    if (czc == 40)
                    {
                        xd1 = 25.3 * scale;
                        d2 = 17 * scale;
                        d3 = 24 * scale;
                        d4 = 21.5 * scale;
                        crks = 16 * scale;
                        d1 = 44.45 * scale;
                        l3 = 43 * scale;
                        l2 = 32 * scale;
                        l5 = 8.2 * scale;
                        pp = 5 * scale;
                        l1 = 65.4 * scale;
                        l4 = 85.2 * scale;
                        dl = 93.4 * scale;
                        yyy = 1.6 * scale;
                        b = 16.1 * scale;
                        t = 22.5 * scale;
                        k = 10 * scale;
                        df = 63 * scale;
                        lpcon = 11.6 * scale;//连接伸出长度
                    }
                    if (czc == 45)
                    {
                        xd1 = 32.4 * scale;
                        d2 = 21 * scale;
                        d3 = 30 * scale;
                        d4 = 26 * scale;
                        crks = 20 * scale;
                        d1 = 57.15 * scale;
                        l3 = 53 * scale;
                        l2 = 40 * scale;
                        l5 = 10 * scale;
                        pp = 6 * scale;
                        l1 = 82.8 * scale;
                        l4 = 96.8 * scale;
                        dl = 106.8 * scale;
                        yyy = 3.2 * scale;
                        b = 19.3 * scale;
                        t = 29 * scale;
                        k = 12 * scale;
                        df = 80 * scale;
                        lpcon = 15.2 * scale;//连接伸出长度
                    }
                    if (czc == 50)
                    {
                        xd1 = 39.6 * scale;
                        d2 = 26 * scale;
                        d3 = 38 * scale;
                        d4 = 32 * scale;
                        crks = 24 * scale;
                        d1 = 69.85 * scale;
                        l3 = 62 * scale;
                        l2 = 47 * scale;
                        l5 = 11.5 * scale;
                        pp = 8 * scale;
                        l1 = 101.8 * scale;
                        l4 = 115.8 * scale;
                        dl = 126.8 * scale;
                        yyy = 3.2 * scale;
                        b = 25.7 * scale;
                        t = 35.3 * scale;
                        k = 12 * scale;
                        df = 97.5 * scale;
                        lpcon = 15.2 * scale;//连接伸出长度
                    }
                    if (czc == 55)
                    {
                        xd1 = 50.4 * scale;
                        d2 = 26 * scale;
                        d3 = 48 * scale;
                        d4 = 36 * scale;
                        crks = 24 * scale;
                        d1 = 88.9 * scale;
                        l3 = 62 * scale;
                        l2 = 47 * scale;
                        l5 = 11.5 * scale;
                        pp = 9 * scale;
                        l1 = 126.8 * scale;
                        l4 = 153.8 * scale;
                        dl = 164.8 * scale;
                        yyy = 3.2 * scale;
                        b = 25.7 * scale;
                        t = 45 * scale;
                        k = 14 * scale;
                        df = 130 * scale;
                        lpcon = 17.2 * scale;//连接伸出长度
                    }
                    if (czc == 60)
                    {
                        xd1 = 60.2 * scale;
                        d2 = 32 * scale;
                        d3 = 58 * scale;
                        d4 = 44 * scale;
                        crks = 30 * scale;
                        d1 = 107.95 * scale;
                        l3 = 76 * scale;
                        l2 = 59 * scale;
                        l5 = 14 * scale;
                        pp = 10 * scale;
                        l1 = 161.8 * scale;
                        l4 = 192.8 * scale;
                        dl = 206.8 * scale;
                        yyy = 3.2 * scale;
                        b = 25.78 * scale;
                        t = 60 * scale;
                        k = 16 * scale;
                        df = 156 * scale;
                        lpcon = 19.2 * scale;//连接伸出长度
                    }
                    if (czc == 65)
                    {
                        xd1 = 75 * scale;
                        d2 = 38 * scale;
                        d3 = 72 * scale;
                        d4 = 52 * scale;
                        crks = 36 * scale;
                        d1 = 133.35 * scale;
                        l3 = 89 * scale;
                        l2 = 70 * scale;
                        l5 = 16 * scale;
                        pp = 12 * scale;
                        l1 = 202 * scale;
                        l4 = 230 * scale;
                        dl = 246 * scale;
                        yyy = 4 * scale;
                        b = 32.4 * scale;
                        t = 72 * scale;
                        k = 18 * scale;
                        df = 195 * scale;
                        lpcon = 22 * scale;//连接伸出长度
                    }
                    if (czc == 70)
                    {
                        xd1 = 92 * scale;
                        d2 = 38 * scale;
                        d3 = 90 * scale;
                        d4 = 52 * scale;
                        crks = 36 * scale;
                        d1 = 165.1 * scale;
                        l3 = 89 * scale;
                        l2 = 70 * scale;
                        l5 = 16 * scale;
                        pp = 14 * scale;
                        l1 = 252 * scale;
                        l4 = 280 * scale;
                        dl = 296 * scale;
                        yyy = 4 * scale;
                        b = 32.4 * scale;
                        t = 86 * scale;
                        k = 20 * scale;
                        df = 230 * scale;
                        lpcon = 24 * scale;//连接伸出长度
                    }
                    if (czc == 75)
                    {
                        xd1 = 114 * scale;
                        d2 = 50 * scale;
                        d3 = 110 * scale;
                        d4 = 68 * scale;
                        crks = 48 * scale;
                        d1 = 203.2 * scale;
                        l3 = 115 * scale;
                        l2 = 92 * scale;
                        l5 = 20 * scale;
                        pp = 16 * scale;
                        l1 = 307 * scale;
                        l4 = 350 * scale;
                        dl = 370 * scale;
                        yyy = 5 * scale;
                        b = 40.5 * scale;
                        t = 104 * scale;
                        k = 22 * scale;
                        df = 280 * scale;
                        lpcon = 27 * scale;//连接伸出长度
                    }
                    if (czc == 80)
                    {
                        xd1 = 140 * scale;
                        d2 = 50 * scale;
                        d3 = 136 * scale;
                        d4 = 68 * scale;
                        crks = 48 * scale;
                        d1 = 254 * scale;
                        l3 = 115 * scale;
                        l2 = 92 * scale;
                        l5 = 20 * scale;
                        pp = 18 * scale;
                        l1 = 394 * scale;
                        l4 = 449 * scale;
                        dl = 469 * scale;
                        yyy = 6 * scale;
                        b = 40.5 * scale;
                        t = 132 * scale;
                        k = 28 * scale;
                        df = 350 * scale;
                        lpcon = 34 * scale;//连接伸出长度
                    }

                }
                string ccms3 = "ZYL10";//工件侧形状
                string ccms2 = Convert.ToString(data["ccms2"]);//工件侧大小
                if (ccms3 == "ZYL10" && ccms2 == "6")
                {
                    dconws = 6 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 25 * scale;
                    dd3 = 6 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 15 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = dl + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "8")
                {
                    dconws = 8 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 28 * scale;
                    dd3 = 8 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 20 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = dl + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "10")
                {
                    dconws = 10 * scale;
                    ll1 = 39 * scale;
                    ll2 = 20 * scale;
                    ll4 = 41 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 35 * scale;
                    dd3 = 10 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 25 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = dl + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "12")
                {
                    dconws = 12 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 42 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 12 * scale;//沉头
                    bted = 30 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = dl + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "14")
                {
                    dconws = 14 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 44 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 14 * scale;//沉头
                    bted = 32 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = dl + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "16")
                {
                    dconws = 16 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 48 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 16 * scale;//沉头
                    bted = 36 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = dl + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "18")
                {
                    dconws = 18 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 50 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 18 * scale;//沉头
                    bted = 38 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = dl + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "20")
                {
                    dconws = 20 * scale;
                    ll1 = 49 * scale;
                    ll2 = 25 * scale;
                    ll4 = 51 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 52 * scale;
                    dd3 = 16 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 20 * scale;//沉头
                    bted = 40 * scale;
                    bhta = 25 * pi / 180;
                    lb = 70 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = dl + lpr;//总长度
                }
                double isframe = Convert.ToDouble(data["isframe"]);
                //判断锥柄skg20
                if (ccms1 == "skg20")
                {
                    //坐标
                    Vector2 v1 = new Vector2(-dl, xd1 / 2);//机床侧外侧
                    Vector2 v2 = new Vector2(-l1 - 1.5, v1.Y);
                    Vector2 v3 = new Vector2(v2.X, d3 / 2);
                    Vector2 v4 = new Vector2(-l1, v3.Y);
                    Vector2 v5 = new Vector2(v4.X, v2.Y);
                    Vector2 v6 = new Vector2(0, d1 / 2);
                    Vector2 v7 = new Vector2(v6.X + yyy, v6.Y);
                    Vector2 v8 = new Vector2(v7.X, -v7.Y);
                    Vector2 v9 = new Vector2(v6.X, -v6.Y);
                    Vector2 v10 = new Vector2(v5.X, -v5.Y);
                    Vector2 v11 = new Vector2(v4.X, -v4.Y);
                    Vector2 v12 = new Vector2(v3.X, -v3.Y);
                    Vector2 v13 = new Vector2(v2.X, -v2.Y);
                    Vector2 v14 = new Vector2(v1.X, -v1.Y);
                    //线段
                    Vector2[] Line1 = { v1, v2 };
                    fun.drawBLine(dxf, Line1, 0.3, contour);
                    Vector2[] Line2 = { v2, v3 };
                    fun.drawBLine(dxf, Line2, 0.3, contour);
                    Vector2[] Line3 = { v3, v4 };
                    fun.drawBLine(dxf, Line3, 0.3, contour);
                    Vector2[] Line4 = { v4, v5 };
                    fun.drawBLine(dxf, Line4, 0.3, contour);
                    Vector2[] Line5 = { v5, v6 };
                    fun.drawBLine(dxf, Line5, 0.3, contour);
                    Vector2[] Line6 = { v6, v7 };
                    fun.drawBLine(dxf, Line6, 0.3, contour);
                    Vector2[] Line7 = { v7, v8 };
                    fun.drawBLine(dxf, Line7, 0.3, contour);
                    Vector2[] Line8 = { v8, v9 };
                    fun.drawBLine(dxf, Line8, 0.3, contour);
                    Vector2[] Line9 = { v9, v10 };
                    fun.drawBLine(dxf, Line9, 0.3, contour);
                    Vector2[] Line10 = { v10, v11 };
                    fun.drawBLine(dxf, Line10, 0.3, contour);
                    Vector2[] Line11 = { v11, v12 };
                    fun.drawBLine(dxf, Line11, 0.3, contour);
                    Vector2[] Line12 = { v12, v13 };
                    fun.drawBLine(dxf, Line12, 0.3, contour);
                    Vector2[] Line13 = { v13, v14 };
                    fun.drawBLine(dxf, Line13, 0.3, contour);
                    Vector2[] Line14 = { v14, v1 };
                    fun.drawBLine(dxf, Line14, 0.3, contour);
                    Vector2[] Line17 = { v6, v9 };
                    fun.drawBLine(dxf, Line17, 0.3, contour);
                    //坐标
                    Vector2 v15 = new Vector2(v1.X, d4 / 2);//机床侧内侧
                    Vector2 v16 = new Vector2(v15.X + 0.5 * scale, v15.Y - 1 * scale);
                    Vector2 v17 = new Vector2(v16.X + (v16.Y - d2) / 2 / Math.Tan(30), d2 / 2);
                    Vector2 v18 = new Vector2(v17.X + l5, v17.Y);
                    Vector2 v19 = new Vector2(v18.X, crks / 2);
                    Vector2 v20 = new Vector2(-dl + l2, v19.Y);
                    Vector2 v21 = new Vector2(-dl + l3, xj / 2);
                    Vector2 v22 = new Vector2(v21.X + 3 * scale, 0);
                    Vector2 v23 = new Vector2(v21.X, -v21.Y);
                    Vector2 v24 = new Vector2(v20.X, -v20.Y);
                    Vector2 v25 = new Vector2(v19.X, -v19.Y);
                    Vector2 v26 = new Vector2(v18.X, -v18.Y);
                    Vector2 v27 = new Vector2(v17.X, -v17.Y);
                    Vector2 v28 = new Vector2(v16.X, -v16.Y);
                    Vector2 v29 = new Vector2(v15.X, -v15.Y);
                    Vector2 v30 = new Vector2(v18.X, v21.Y);
                    Vector2 v31 = new Vector2(v25.X, v23.Y);
                    //线段
                    Vector2[] Line18 = { v15, v16 };
                    fun.drawBLine(dxf, Line18, 0.3, contour);
                    Vector2[] Line19 = { v16, v17 };
                    fun.drawBLine(dxf, Line19, 0.3, contour);
                    Vector2[] Line20 = { v17, v18 };
                    fun.drawBLine(dxf, Line20, 0.3, contour);
                    Vector2[] Line21 = { v18, v30 };
                    fun.drawBLine(dxf, Line21, 0.3, contour);
                    Vector2[] Line22 = { v30, v21 };
                    fun.drawBLine(dxf, Line22, 0.3, contour);
                    Vector2[] Line23 = { v21, v22 };
                    fun.drawBLine(dxf, Line23, 0.3, contour);
                    Vector2[] Line24 = { v22, v23 };
                    fun.drawBLine(dxf, Line24, 0.3, contour);
                    Vector2[] Line25 = { v23, v31 };
                    fun.drawBLine(dxf, Line25, 0.3, contour);
                    Vector2[] Line26 = { v31, v26 };
                    fun.drawBLine(dxf, Line26, 0.3, contour);
                    Vector2[] Line27 = { v26, v27 };
                    fun.drawBLine(dxf, Line27, 0.3, contour);
                    Vector2[] Line28 = { v27, v28 };
                    fun.drawBLine(dxf, Line28, 0.3, contour);
                    Vector2[] Line29 = { v28, v29 };
                    fun.drawBLine(dxf, Line29, 0.3, contour);
                    Vector2[] Line30 = { v29, v15 };
                    fun.drawBLine(dxf, Line30, 0.3, contour);
                    Vector2[] Line31 = { v19, v20 };
                    fun.drawBLine(dxf, Line31, 0.3, contour);
                    Vector2[] Line32 = { v20, v24 };
                    fun.drawBLine(dxf, Line32, 0.3, contour);
                    Vector2[] Line33 = { v24, v25 };
                    fun.drawBLine(dxf, Line33, 0.3, contour);
                    Vector2[] Line34 = { v16, v28 };
                    fun.drawBLine(dxf, Line34, 0.3, contour);
                    Vector2[] Line35 = { v17, v27 };
                    fun.drawBLine(dxf, Line35, 0.3, contour);
                    Vector2[] Line36 = { v21, v23 };
                    fun.drawBLine(dxf, Line36, 0.3, contour);
                    //坐标
                    Vector2 v32 = new Vector2(v7.X, (df - t) / 2);//法兰
                    Vector2 v33 = new Vector2(v32.X, df / 2);
                    Vector2 v34 = new Vector2(lpcon, v33.Y);
                    Vector2 v35 = new Vector2(v34.X, v32.Y);
                    Vector2 v36 = new Vector2(v35.X, -v35.Y);
                    Vector2 v37 = new Vector2(v34.X, -v34.Y);
                    Vector2 v38 = new Vector2(v33.X, -v33.Y);
                    Vector2 v39 = new Vector2(v32.X, -v32.Y);
                    Vector2 v40 = new Vector2(0, 0);
                    //线段
                    Vector2[] Line37 = { v33, v34 };
                    fun.drawBLine(dxf, Line37, 0.3, contour);
                    Vector2[] Line38 = { v34, v37 };
                    fun.drawBLine(dxf, Line38, 0.3, contour);
                    Vector2[] Line39 = { v37, v38 };
                    fun.drawBLine(dxf, Line39, 0.3, contour);
                    Vector2[] Line40 = { v38, v33 };
                    fun.drawBLine(dxf, Line40, 0.3, contour);
                    Vector2[] Line41 = { v32, v35 };
                    fun.drawBLine(dxf, Line41, 0.3, contour);
                    Vector2[] Line42 = { v36, v39 };
                    fun.drawBLine(dxf, Line42, 0.3, contour);
                    //填充
                    LwPolyline hatchpoly3 = new LwPolyline();
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v1));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v2));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v3));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v4));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v5));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v6));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v40));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v22));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v21));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v20));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v19));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v18));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v17));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v16));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v15));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v14));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v13));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v12));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v11));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v10));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v9));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v40));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v22));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v23));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v24));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v25));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v26));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v27));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v28));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v29));
                    hatchpoly3.IsClosed = true;
                    String[] htype3 = new String[100];
                    Line[] hline3 = new Line[100];
                    int hnumst3 = hatchpoly3.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst3; i++)
                    {
                        htype3[i] = hatchpoly3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype3[i] == "Line")
                        {
                            hline3[i] = (Line)hatchpoly3.Explode()[i];
                        }
                    }
                    fun.hatchsubofline(dxf, htype3, hnumst3, 45, 5, hline3, hatching);
                }
                if (ccms3 == "ZYL10")//工件侧
                {
                    //坐标
                    Vector2 v51 = new Vector2(lpcon, bd / 2);//工件侧外侧
                    Vector2 v52 = new Vector2(lpcon + lb - ll2 - ct / 2, v51.Y);
                    Vector2 v55 = new Vector2(lpcon + lb - ll2 + ct / 2, v52.Y);
                    Vector2 v56 = new Vector2(lpcon + lb - (bd - bted) / 2 / Math.Tan(bhta), v52.Y);
                    Vector2 v57 = new Vector2(lpcon + lb, bted / 2);
                    Vector2 v58 = new Vector2(v51.X, -v51.Y);
                    Vector2 v59 = new Vector2(v56.X, -v56.Y);
                    Vector2 v60 = new Vector2(v57.X, -v57.Y);
                    Vector2 v98 = new Vector2(v57.X, v56.Y);
                    //线段
                    Vector2[] Line58 = { v51, v52 };
                    fun.drawBLine(dxf, Line58, 0.3, contour);
                    Vector2[] Line60 = { v55, v56 };
                    fun.drawBLine(dxf, Line60, 0.3, contour);
                    Vector2[] Line61 = { v56, v57 };
                    fun.drawBLine(dxf, Line61, 0.3, contour);
                    Vector2[] Line62 = { v57, v60 };
                    fun.drawBLine(dxf, Line62, 0.3, contour);
                    Vector2[] Line63 = { v60, v59 };
                    fun.drawBLine(dxf, Line63, 0.3, contour);
                    Vector2[] Line64 = { v59, v58 };
                    fun.drawBLine(dxf, Line64, 0.3, contour);
                    Vector2[] Line65 = { v58, v51 };
                    fun.drawBLine(dxf, Line65, 0.3, contour);
                    Line Line93 = new Line(v56, v98);
                    Line93.Layer = dimensioning;
                    dxf.AddEntity(Line93);

                    //坐标
                    Vector2 v61 = new Vector2(v57.X, dconws / 2 + 1);//工件侧内侧
                    Vector2 v62 = new Vector2(v61.X - 1, dconws / 2);
                    Vector2 v63 = new Vector2(v57.X - ll1, v62.Y);
                    Vector2 v64 = new Vector2(v57.X - ll4, v63.Y);
                    Vector2 v65 = new Vector2(v64.X, dconws / 4);
                    Vector2 v66 = new Vector2(v51.X, v65.Y);
                    Vector2 v67 = new Vector2(v61.X, -v61.Y);
                    Vector2 v68 = new Vector2(v62.X, -v62.Y);
                    Vector2 v69 = new Vector2(v63.X, -v63.Y);
                    Vector2 v70 = new Vector2(v64.X, -v64.Y);
                    Vector2 v71 = new Vector2(v65.X, -v65.Y);
                    Vector2 v72 = new Vector2(v66.X, -v66.Y);
                    Vector2 v81 = new Vector2((v69.X + v70.X) / 2, v70.Y);
                    double lll = v63.X - v64.X;
                    double hhh = (v63.X - v64.X) / 2;
                    // 线段
                    Vector2[] Line67 = { v61, v62 };
                    fun.drawBLine(dxf, Line67, 0.3, contour);
                    LwPolyline Arc7 = new LwPolyline();
                    Arc7.Vertexes.Add(new LwPolylineVertex(v63));
                    Arc7.Vertexes.Add(new LwPolylineVertex(v64));
                    Arc7.Vertexes[0].Bulge = 2 * hhh / lll;
                    fun.PolyFill(dxf, Arc7, 0.3, contour);
                    Vector2[] Line70 = { v64, v65 };
                    fun.drawBLine(dxf, Line70, 0.3, contour);
                    Vector2[] Line71 = { v65, v66 };
                    fun.drawBLine(dxf, Line71, 0.3, contour);
                    Vector2[] Line72 = { v66, v72 };
                    fun.drawBLine(dxf, Line72, 0.3, contour);
                    Vector2[] Line73 = { v72, v71 };
                    fun.drawBLine(dxf, Line73, 0.3, contour);
                    Vector2[] Line74 = { v71, v70 };
                    fun.drawBLine(dxf, Line74, 0.3, contour);
                    LwPolyline Arc8 = new LwPolyline();
                    Arc8.Vertexes.Add(new LwPolylineVertex(v70));
                    Arc8.Vertexes.Add(new LwPolylineVertex(v69));
                    Arc8.Vertexes[0].Bulge = 2 * hhh / lll;
                    fun.PolyFill(dxf, Arc8, 0.3, contour);
                    Vector2[] Line76 = { v69, v68 };
                    fun.drawBLine(dxf, Line76, 0.3, contour);
                    Vector2[] Line77 = { v68, v67 };
                    fun.drawBLine(dxf, Line77, 0.3, contour);
                    Vector2[] Line78 = { v67, v61 };
                    fun.drawBLine(dxf, Line78, 0.3, contour);
                    Vector2[] Line79 = { v63, v69 };
                    fun.drawBLine(dxf, Line79, 0.3, contour);
                    Vector2[] Line80 = { v64, v70 };
                    fun.drawBLine(dxf, Line80, 0.3, contour);
                    Vector2[] Line81 = { v62, v68 };
                    fun.drawBLine(dxf, Line81, 0.3, contour);

                    //坐标
                    Vector2 v73 = new Vector2(v52.X, v52.Y - 1 * scale);//螺纹内部
                    Vector2 v74 = new Vector2(lpcon + lb - ll2 - xj2 / 2, v73.Y);
                    Vector2 v75 = new Vector2(lpcon + lb - ll2 - 2.5 * scale, v74.Y);
                    Vector2 v76 = new Vector2(lpcon + lb - ll2 + 2.5 * scale, v75.Y);
                    Vector2 v77 = new Vector2(lpcon + lb - ll2 + xj2 / 2, v76.Y);
                    Vector2 v78 = new Vector2(v55.X, v77.Y);
                    Vector2 v79 = new Vector2(v74.X, v62.Y);
                    Vector2 v80 = new Vector2(v77.X, v62.Y);
                    Vector2 v97 = new Vector2((v79.X + v80.X) / 2, v79.Y + xj2 / 2 / Math.Tan(118 * pi / 180 / 2));
                    double llll = xj2;
                    double hhhh = xj2 / 2 / Math.Tan(118 * pi / 180 / 2);
                    double xx = (v55.X + v52.X) / 2;//圆的x轴坐标
                    double yy = ((v77.X - xx) * (v77.X - xx) - (v55.X - xx) * (v55.X - xx) - v55.Y * v55.Y + v77.Y * v77.Y) / (2 * (v77.Y - v55.Y));//圆的y轴坐标
                    double rr = Math.Sqrt((v77.X - xx) * (v77.X - xx) + (v77.Y - yy) * (v77.Y - yy));//圆的半径
                    double lllll = Math.Sqrt((v55.X - v77.X) * (v55.X - v77.X) + (v55.Y - v77.Y) * (v55.Y - v77.Y));
                    double hhhhh = rr - (Math.Sqrt((rr * rr) - lllll * lllll / 4));
                    //线段
                    Vector2[] Line82 = { v73, v78 };
                    fun.drawBLine(dxf, Line82, 0.3, contour);
                    Vector2[] Line83 = { v74, v79 };
                    fun.drawBLine(dxf, Line83, 0.3, contour);
                    Vector2[] Line86 = { v80, v77 };
                    fun.drawBLine(dxf, Line86, 0.3, contour);
                    Vector2[] Line87 = { v52, v73 };
                    fun.drawBLine(dxf, Line87, 0.3, contour);
                    Vector2[] Line88 = { v55, v78 };
                    fun.drawBLine(dxf, Line88, 0.3, contour);
                    Vector2[] Line68 = { v62, v80 };
                    fun.drawBLine(dxf, Line68, 0.3, contour);
                    Vector2[] Line89 = { v63, v79 };
                    fun.drawBLine(dxf, Line89, 0.3, contour);
                    LwPolyline Arc9 = new LwPolyline();
                    Arc9.Vertexes.Add(new LwPolylineVertex(v79));
                    Arc9.Vertexes.Add(new LwPolylineVertex(v80));
                    Arc9.Vertexes[0].Bulge = 2 * hhhh / llll;
                    fun.PolyFill(dxf, Arc9, 0.3, contour);
                    LwPolyline Arc10 = new LwPolyline();
                    Arc10.Vertexes.Add(new LwPolylineVertex(v52));
                    Arc10.Vertexes.Add(new LwPolylineVertex(v74));
                    Arc10.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                    fun.PolyFill(dxf, Arc10, 0.3, contour);
                    LwPolyline Arc11 = new LwPolyline();
                    Arc11.Vertexes.Add(new LwPolylineVertex(v77));
                    Arc11.Vertexes.Add(new LwPolylineVertex(v55));
                    Arc11.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                    fun.PolyFill(dxf, Arc11, 0.3, contour);
                    //第一区域填充
                    LwPolyline hatchpoly1 = new LwPolyline();
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v73));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v74));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v79));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v63));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v64));
                    hatchpoly1.Vertexes[5].Bulge = 1;
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v65));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v66));
                    hatchpoly1.IsClosed = true;
                    String[] htype1 = new String[100];
                    Line[] hline1 = new Line[100];
                    Arc[] arc1 = new Arc[100];
                    int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst1; i++)
                    {
                        htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype1[i] == "Line")
                        {
                            hline1[i] = (Line)hatchpoly1.Explode()[i];
                        }
                        if (htype1[i] == "Arc")
                        {
                            arc1[i] = (Arc)hatchpoly1.Explode()[i];
                        }
                    }
                    fun.hatchsub1(dxf, htype1, hnumst1, 45, 10 * scale, hline1, arc1, hatching);

                    //第二区域填充
                    LwPolyline hatchpoly2 = new LwPolyline();
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v72));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v71));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v70));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v69));
                    hatchpoly2.Vertexes[2].Bulge = 1;
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v68));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v67));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v60));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v59));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v58));
                    hatchpoly2.IsClosed = true;
                    String[] htype2 = new String[100];
                    Line[] hline2 = new Line[100];
                    Arc[] arc2 = new Arc[100];
                    int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst2; i++)
                    {
                        htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype2[i] == "Line")
                        {
                            hline2[i] = (Line)hatchpoly2.Explode()[i];
                        }
                        if (htype2[i] == "Arc")
                        {
                            arc2[i] = (Arc)hatchpoly2.Explode()[i];
                        }
                    }
                    fun.hatchsub1(dxf, htype2, hnumst2, 45, 10 * scale, hline2, arc2, hatching);
                    //第三区域填充
                    LwPolyline hatchpoly3 = new LwPolyline();
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v77));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v78));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v55));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v56));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v57));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v61));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v62));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                    hatchpoly3.IsClosed = true;
                    String[] htype3 = new String[100];
                    Line[] hline3 = new Line[100];
                    int hnumst3 = hatchpoly3.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst3; i++)
                    {
                        htype3[i] = hatchpoly3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype3[i] == "Line")
                        {
                            hline3[i] = (Line)hatchpoly3.Explode()[i];
                        }
                    }
                    fun.hatchsubofline(dxf, htype3, hnumst3, 45, 5, hline3, hatching);
                    //文本样式
                    DimensionStyle dimensionStyle = fun.CreateDimStyle();
                    dimensionStyle.ArrowSize = 0.2;
                    dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                    dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
                    dimensionStyle.TextHeight = 1.0;
                    double offset = 10;
                    //标注
                    LinearDimension dim1 = new LinearDimension(new Line(new Vector2(-dl, xd1 / 2), v60), 4 * offset + (xd1 / 2 - v60.Y) / 2, 180, dimensionStyle);
                    dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                    dxf.AddEntity(dim1);

                    LinearDimension dim2 = new LinearDimension(new Line(new Vector2(lpcon, -df / 2 + 1), v60), offset + (v60.Y - (-df / 2)) / 2, 180, dimensionStyle);
                    dim2.UserText = "LB="+ Math.Round(lb / scale, 2);
                    dxf.AddEntity(dim2);

                    LinearDimension dim3 = new LinearDimension(new Line(v81, v60), 2 * offset + (v81.Y + v60.Y) / 2 - v58.Y, 180, dimensionStyle);
                    dim3.UserText = "LSC="+ Math.Round(lsc / scale, 2);
                    dxf.AddEntity(dim3);

                    LinearDimension dim4 = new LinearDimension(new Line(new Vector2(0, d1 / 2), v57), 3 * offset + df / 2 - (v57.Y + d1 / 2) / 2, 0, dimensionStyle);
                    dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                    dxf.AddEntity(dim4);

                    LinearDimension dim5 = new LinearDimension(new Line(new Vector2(0, d1 / 2), v97), 2 * offset + df / 2 - (v97.Y + d1 / 2) / 2, 0, dimensionStyle);
                    dim5.UserText = "LF="+ Math.Round(lf / scale, 2);
                    dxf.AddEntity(dim5);

                    LinearDimension dim6 = new LinearDimension(new Line(new Vector2(0, d1 / 2), new Vector2(lpcon, df / 2 - 1)), offset + (df / 2 - d1 / 2) / 2, 0, dimensionStyle);
                    dim6.UserText = "LPCON="+ Math.Round(lpcon / scale, 2);
                    dxf.AddEntity(dim6);

                    Angular2LineDimension dim7 = new Angular2LineDimension(new Line(v56, v98), new Line(v56, v57), offset, dimensionStyle);
                    dim7.UserText = String.Format("BHTA={0}°", bhta / (pi / 180));
                    dxf.AddEntity(dim7);

                    LinearDimension dim8 = new LinearDimension(new Line(new Vector2(-dl + 0.5 * scale + (d4 / 2 - 1 * scale - d2) / 2 / Math.Tan(30) + l5, crks / 2), new Vector2(-l1, -crks / 2)), offset, 90, dimensionStyle);
                    dim8.UserText = "CRKS="+ Math.Round(crks / scale, 2);
                    dxf.AddEntity(dim8);

                    LinearDimension dim9 = new LinearDimension(new Line(new Vector2(lpcon - 1, df / 2), new Vector2(lpcon - 1, -df / 2)), offset, 270, dimensionStyle);
                    dim9.UserText = "DF="+ Math.Round(df / scale, 2);
                    dxf.AddEntity(dim9);

                    LinearDimension dim10 = new LinearDimension(new Line(v56, v59), 3 * offset + v57.X - v56.X, 270, dimensionStyle);
                    dim10.UserText = "BD="+ Math.Round(bd / scale, 2);
                    dxf.AddEntity(dim10);

                    LinearDimension dim11 = new LinearDimension(new Line(v57, v60), 2 * offset, 270, dimensionStyle);
                    dim11.UserText = "BTED="+ Math.Round(bted / scale, 2);
                    dxf.AddEntity(dim11);

                    LinearDimension dim12 = new LinearDimension(new Line(v62, v68), offset + v61.X - v62.X, 270, dimensionStyle);
                    dim12.UserText = "DCONWS="+ Math.Round(dconws / scale, 2);
                    dxf.AddEntity(dim12);

                    LinearDimension dim13 = new LinearDimension(new Line(v74, v77), offset, 0, dimensionStyle);
                    dim13.UserText = "DD3="+ Math.Round(dd3 / scale, 2);
                    dxf.AddEntity(dim13);

                    //图框
                    if (isframe == 1)
                    {
                        Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-l1 + oal / 2 - 210, d1 / 2 + 148.5 - d1 / 2));
                        fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                    }
                }
                //文件格式
                dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
                dxf.Save(path);
            }
            if (ccms1 == "hsk01")
            {
                double soal = Convert.ToDouble(data["l1"]) + Convert.ToDouble(data["l2"]) + Convert.ToDouble(data["f1"]) + Convert.ToDouble(data["lb"]);//总长度
                double scale = Convert.ToDouble(data["scale"]);//比例
                if (scale == 0)
                {
                    if (soal < 53.8)
                    {
                        scale = 5.0;
                    }
                    else if (soal < 67.25)
                    {
                        scale = 4.0;
                    }
                    else if (soal < 90)
                    {
                        scale = 3.0;
                    }
                    else if (soal < 134.5)
                    {
                        scale = 1.5;
                    }
                    else if (soal < 269)
                    {
                        scale = 1.0;
                    }
                    else if (soal < 359)
                    {
                        scale = 0.75;
                    }
                    else
                    {
                        scale = 0.5;
                    }
                }//比例判断
                double lb = Convert.ToDouble(data["lb"]) * scale;//体长
                double l2 = Convert.ToDouble(data["l2"]) * scale;
                double f1 = Convert.ToDouble(data["f1"]) * scale;
                double lpcon = l2 + f1;//连接伸出长度
                double lpr = lpcon + lb;//伸出长度
                double l1 = Convert.ToDouble(data["l1"]) * scale;
                double oal = l1 + lpr;//总长度
                //法兰
                double r4 = Convert.ToDouble(data["r4"]) * scale;
                double β1 = Convert.ToDouble(data["b1"]) * pi / 180;
                double d10 = Convert.ToDouble(data["d10"]) * scale;
                //工件侧
                double ll1 = Convert.ToDouble(data["ll1"]) * scale;
                double ll4 = Convert.ToDouble(data["ll4"]) * scale;
                double lsc = (ll1 + ll4) / 2;//夹紧长度
                double dconws = Convert.ToDouble(data["dconws"]) * scale;//工件侧连接直径
                double bted = Convert.ToDouble(data["bted"]) * scale;//体锥度端径
                double bd = Convert.ToDouble(data["bd"]) * scale;//体直径
                double bhta = Convert.ToDouble(data["bhta"]) * pi / 180;//体半锥角
                double ll2 = Convert.ToDouble(data["ll2"]) * scale;
                double lf = lpr - ll2;//功能长度
                double dd3 = Convert.ToDouble(data["dd3"]) * scale;
                double p2 = Convert.ToDouble(data["p2"]) * scale;//螺距
                double xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                double ct = Convert.ToDouble(data["ct"]) * scale;
                //hsk
                double df = Convert.ToDouble(data["df"]) * scale;//法兰直径
                double czc = Convert.ToDouble(data["czc"]);
                double f3 = Convert.ToDouble(data["f3"]) * scale;
                double f4 = Convert.ToDouble(data["f4"]) * scale;
                double d1 = Convert.ToDouble(data["d1"]) * scale;
                double d2 = Convert.ToDouble(data["d2"]) * scale;
                double r1 = Convert.ToDouble(data["r1"]) * scale;
                double β = Convert.ToDouble(data["bb"]) * pi / 180;
                if (ccms1 == "hsk01")//机床测1
                {
                    if (czc == 25)
                    {
                        l1 = 13 * scale;
                        l2 = 2.5 * scale;
                        f1 = 10 * scale;
                        f3 = 4.5 * scale;
                        f4 = 2 * scale;
                        d1 = 25 * scale;
                        d2 = 19.006 * scale;
                        d10 = 22 * scale;
                        df = 25 * scale;
                        r1 = 0.5 * scale;
                        lpcon = l2 + f1;
                        β = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 32)
                    {
                        l1 = 16 * scale;
                        l2 = 3.2 * scale;
                        f1 = 20 * scale;
                        f3 = 16 * scale;
                        f4 = 2 * scale;
                        d1 = 32 * scale;
                        d2 = 24.007 * scale;
                        d10 = 26.5 * scale;
                        df = 32 * scale;
                        r1 = 0.6 * scale;
                        lpcon = l2 + f1;
                        β = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 40)
                    {
                        l1 = 20 * scale;
                        l2 = 4 * scale;
                        f1 = 20 * scale;
                        f3 = 16 * scale;
                        f4 = 2 * scale;
                        d1 = 40 * scale;
                        d2 = 30.007 * scale;
                        d10 = 34.8 * scale;
                        df = 40 * scale;
                        r1 = 0.8 * scale;
                        lpcon = l2 + f1;
                        β = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 50)
                    {
                        l1 = 25 * scale;
                        l2 = 5 * scale;
                        f1 = 26 * scale;
                        f3 = 18 * scale;
                        f4 = 3.75 * scale;
                        d1 = 50 * scale;
                        d2 = 38.009 * scale;
                        d10 = 43 * scale;
                        df = 50 * scale;
                        r1 = 1 * scale;
                        lpcon = l2 + f1;
                        β = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 63)
                    {
                        l1 = 32 * scale;
                        l2 = 6.3 * scale;
                        f1 = 26 * scale;
                        f3 = 18 * scale;
                        f4 = 3.75 * scale;
                        d1 = 63 * scale;
                        d2 = 48.01 * scale;
                        d10 = 55 * scale;
                        df = 63 * scale;
                        r1 = 1.2 * scale;
                        lpcon = l2 + f1;
                        β = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 80)
                    {
                        l1 = 40 * scale;
                        l2 = 8 * scale;
                        f1 = 26 * scale;
                        f3 = 18 * scale;
                        f4 = 3.75 * scale;
                        d1 = 80 * scale;
                        d2 = 60.012 * scale;
                        d10 = 70 * scale;
                        df = 80 * scale;
                        r1 = 1.6 * scale;
                        lpcon = l2 + f1;
                        β = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 100)
                    {
                        l1 = 50 * scale;
                        l2 = 10 * scale;
                        f1 = 29 * scale;
                        f3 = 20 * scale;
                        f4 = 3.75 * scale;
                        d1 = 100 * scale;
                        d2 = 75.013 * scale;
                        d10 = 92 * scale;
                        df = 100 * scale;
                        r1 = 2 * scale;
                        lpcon = l2 + f1;
                        β = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 125)
                    {
                        l1 = 63 * scale;
                        l2 = 12.5 * scale;
                        f1 = 29 * scale;
                        f3 = 20 * scale;
                        f4 = 3.75 * scale;
                        d1 = 125 * scale;
                        d2 = 95.016 * scale;
                        d10 = 117 * scale;
                        df = 125 * scale;
                        r1 = 2.5 * scale;
                        lpcon = l2 + f1;
                        β = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }
                    if (czc == 160)
                    {
                        l1 = 80 * scale;
                        l2 = 16 * scale;
                        f1 = 31 * scale;
                        f3 = 22 * scale;
                        f4 = 3.75 * scale;
                        d1 = 160 * scale;
                        d2 = 120.016 * scale;
                        d10 = 152 * scale;
                        df = 160 * scale;
                        r1 = 3.2 * scale;
                        lpcon = l2 + f1;
                        β = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                        β1 = 60 * pi / 180;
                        r4 = 1 * scale;
                    }

                }
                string ccms3 = "ZYL10";//工件侧形状
                string ccms2 = Convert.ToString(data["ccms2"]);//工件侧大小
                if (ccms3 == "ZYL10" && ccms2 == "6")
                {
                    dconws = 6 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 25 * scale;
                    dd3 = 6 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 15 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "8")
                {
                    dconws = 8 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 28 * scale;
                    dd3 = 8 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 20 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "10")
                {
                    dconws = 10 * scale;
                    ll1 = 39 * scale;
                    ll2 = 20 * scale;
                    ll4 = 41 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 35 * scale;
                    dd3 = 10 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 25 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "12")
                {
                    dconws = 12 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 42 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 12 * scale;//沉头
                    bted = 30 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "14")
                {
                    dconws = 14 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 44 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 14 * scale;//沉头
                    bted = 32 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "16")
                {
                    dconws = 16 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 48 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 16 * scale;//沉头
                    bted = 36 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "18")
                {
                    dconws = 18 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 50 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 18 * scale;//沉头
                    bted = 38 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "20")
                {
                    dconws = 20 * scale;
                    ll1 = 49 * scale;
                    ll2 = 25 * scale;
                    ll4 = 51 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 52 * scale;
                    dd3 = 16 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 20 * scale;//沉头
                    bted = 40 * scale;
                    bhta = 25 * pi / 180;
                    lb = 70 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l1 + lpr;//总长度
                }
                double isframe = Convert.ToDouble(data["isframe"]);
                //判断锥柄skg
                if (ccms1 == "hsk01")
                {
                    //坐标
                    Vector2 v2 = new Vector2(-l1 + (r1 - r1 * Math.Sin(β)), d2 / 2 - l1 * Math.Tan(β) + (r1 - r1 * Math.Sin(β)) * r1 * Math.Tan(β));//机床侧
                    Vector2 v1 = new Vector2(-l1, v2.Y - r1 * Math.Cos(β));
                    Vector2 v3 = new Vector2(0, d2 / 2);
                    Vector2 v4 = new Vector2(l2, v3.Y);
                    Vector2 v5 = new Vector2(v4.X, -v4.Y);
                    Vector2 v6 = new Vector2(v3.X, -v3.Y);
                    Vector2 v7 = new Vector2(v2.X, -v2.Y);
                    Vector2 v8 = new Vector2(v1.X, -v1.Y);
                    double l = Math.Sqrt((v2.X - v1.X) * (v2.X - v1.X) + (v2.Y - v1.Y) * (v2.Y - v1.Y));
                    double h = r1 - (Math.Sqrt((r1 * r1) - l * l / 4));
                    //线段
                    LwPolyline Arc1 = new LwPolyline();
                    Arc1.Vertexes.Add(new LwPolylineVertex(v2));
                    Arc1.Vertexes.Add(new LwPolylineVertex(v1));
                    Arc1.Vertexes[0].Bulge = 2 * h / l;
                    fun.PolyFill(dxf, Arc1, 0.3, contour);
                    Vector2[] Line1 = { v2, v3 };
                    fun.drawBLine(dxf, Line1, 0.3, contour);
                    Vector2[] Line2 = { v3, v4 };
                    fun.drawBLine(dxf, Line2, 0.3, contour);
                    Vector2[] Line3 = { v4, v5 };
                    fun.drawBLine(dxf, Line3, 0.3, contour);
                    Vector2[] Line4 = { v5, v6 };
                    fun.drawBLine(dxf, Line4, 0.3, contour);
                    Vector2[] Line5 = { v6, v7 };
                    fun.drawBLine(dxf, Line5, 0.3, contour);
                    LwPolyline Arc2 = new LwPolyline();
                    Arc2.Vertexes.Add(new LwPolylineVertex(v8));
                    Arc2.Vertexes.Add(new LwPolylineVertex(v7));
                    Arc2.Vertexes[0].Bulge = 2 * h / l;
                    fun.PolyFill(dxf, Arc2, 0.3, contour);
                    Vector2[] Line6 = { v8, v1 };
                    fun.drawBLine(dxf, Line6, 0.3, contour);
                    Vector2[] Line7 = { v2, v7 };
                    fun.drawBLine(dxf, Line7, 0.3, contour);
                    Vector2[] Line8 = { v3, v6 };
                    fun.drawBLine(dxf, Line8, 0.3, contour);

                    //坐标
                    Vector2 v9 = new Vector2(l2, df / 2 - 1);//法兰外侧
                    Vector2 v10 = new Vector2(l2 + 1, df / 2);
                    Vector2 v11 = new Vector2(f3 - f4 / 2 - (df / 2 - d10 / 2 - r4 / 2) * Math.Tan(β1 / 2), v10.Y);
                    Vector2 v12 = new Vector2(f3 - f4 / 2, d10 / 2 + r4 / 2);
                    Vector2 v13 = new Vector2(v12.X + r4 / 2 / Math.Tan(β1 / 2), d10 / 2);
                    Vector2 v14 = new Vector2(f3 + f4 / 2 - r4 / 2 / Math.Tan(β1 / 2), v13.Y);
                    Vector2 v15 = new Vector2(f3 + f4 / 2, v12.Y);
                    Vector2 v16 = new Vector2(v15.X + (df / 2 - d10 / 2 - r4 / 2) * Math.Tan(β1 / 2), v11.Y);
                    Vector2 v17 = new Vector2(lpcon - 1, v16.Y);
                    Vector2 v18 = new Vector2(lpcon, v16.Y - 1);
                    Vector2 v19 = new Vector2(v9.X, -v9.Y);
                    Vector2 v20 = new Vector2(v10.X, -v10.Y);
                    Vector2 v21 = new Vector2(v11.X, -v11.Y);
                    Vector2 v22 = new Vector2(v12.X, -v12.Y);
                    Vector2 v23 = new Vector2(v13.X, -v13.Y);
                    Vector2 v24 = new Vector2(v14.X, -v14.Y);
                    Vector2 v25 = new Vector2(v15.X, -v15.Y);
                    Vector2 v26 = new Vector2(v16.X, -v16.Y);
                    Vector2 v27 = new Vector2(v17.X, -v17.Y);
                    Vector2 v28 = new Vector2(v18.X, -v18.Y);
                    double ll = Math.Sqrt((v15.X - v14.X) * (v15.X - v14.X) + (v15.Y - v14.Y) * (v15.Y - v14.Y));
                    double hh = r4 - (Math.Sqrt((r4 * r4) - ll * ll / 4));
                    //线段
                    Vector2[] Line19 = { v9, v10 };
                    fun.drawBLine(dxf, Line19, 0.3, contour);
                    Vector2[] Line20 = { v10, v11 };
                    fun.drawBLine(dxf, Line20, 0.3, contour);
                    Vector2[] Line21 = { v11, v12 };
                    fun.drawBLine(dxf, Line21, 0.3, contour);
                    LwPolyline Arc3 = new LwPolyline();
                    Arc3.Vertexes.Add(new LwPolylineVertex(v12));
                    Arc3.Vertexes.Add(new LwPolylineVertex(v13));
                    Arc3.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc3, 0.3, contour);
                    Vector2[] Line22 = { v13, v14 };
                    fun.drawBLine(dxf, Line22, 0.3, contour);
                    LwPolyline Arc4 = new LwPolyline();
                    Arc4.Vertexes.Add(new LwPolylineVertex(v14));
                    Arc4.Vertexes.Add(new LwPolylineVertex(v15));
                    Arc4.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc4, 0.3, contour);
                    Vector2[] Line23 = { v15, v16 };
                    fun.drawBLine(dxf, Line23, 0.3, contour);
                    Vector2[] Line24 = { v16, v17 };
                    fun.drawBLine(dxf, Line24, 0.3, contour);
                    Vector2[] Line25 = { v17, v18 };
                    fun.drawBLine(dxf, Line25, 0.3, contour);
                    Vector2[] Line26 = { v18, v28 };
                    fun.drawBLine(dxf, Line26, 0.3, contour);
                    Vector2[] Line27 = { v28, v27 };
                    fun.drawBLine(dxf, Line27, 0.3, contour);
                    Vector2[] Line28 = { v27, v26 };
                    fun.drawBLine(dxf, Line28, 0.3, contour);
                    Vector2[] Line29 = { v26, v25 };
                    fun.drawBLine(dxf, Line29, 0.3, contour);
                    LwPolyline Arc5 = new LwPolyline();
                    Arc5.Vertexes.Add(new LwPolylineVertex(v25));
                    Arc5.Vertexes.Add(new LwPolylineVertex(v24));
                    Arc5.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc5, 0.3, contour);
                    Vector2[] Line30 = { v24, v23 };
                    fun.drawBLine(dxf, Line30, 0.3, contour);
                    LwPolyline Arc6 = new LwPolyline();
                    Arc6.Vertexes.Add(new LwPolylineVertex(v23));
                    Arc6.Vertexes.Add(new LwPolylineVertex(v22));
                    Arc6.Vertexes[0].Bulge = 2 * hh / ll;
                    fun.PolyFill(dxf, Arc6, 0.3, contour);
                    Vector2[] Line31 = { v22, v21 };
                    fun.drawBLine(dxf, Line31, 0.3, contour);
                    Vector2[] Line32 = { v21, v20 };
                    fun.drawBLine(dxf, Line32, 0.3, contour);
                    Vector2[] Line33 = { v20, v19 };
                    fun.drawBLine(dxf, Line33, 0.3, contour);
                    Vector2[] Line34 = { v19, v9 };
                    fun.drawBLine(dxf, Line34, 0.3, contour);
                    Vector2[] Line35 = { v10, v20 };
                    fun.drawBLine(dxf, Line35, 0.3, contour);
                    Vector2[] Line36 = { v11, v21 };
                    fun.drawBLine(dxf, Line36, 0.3, contour);
                    Vector2[] Line37 = { v12, v22 };
                    fun.drawBLine(dxf, Line37, 0.3, contour);
                    Vector2[] Line38 = { v13, v23 };
                    fun.drawBLine(dxf, Line38, 0.3, contour);
                    Vector2[] Line39 = { v14, v24 };
                    fun.drawBLine(dxf, Line39, 0.3, contour);
                    Vector2[] Line40 = { v15, v25 };
                    fun.drawBLine(dxf, Line40, 0.3, contour);
                    Vector2[] Line41 = { v16, v26 };
                    fun.drawBLine(dxf, Line41, 0.3, contour);
                    Vector2[] Line42 = { v17, v27 };
                    fun.drawBLine(dxf, Line42, 0.3, contour);
                }
                //工件侧
                if (ccms3 == "ZYL10")
                {
                    //坐标
                    Vector2 v51 = new Vector2(lpcon, bd / 2);//工件侧外侧
                    Vector2 v52 = new Vector2(lpcon + lb - ll2 - ct / 2, v51.Y);
                    Vector2 v55 = new Vector2(lpcon + lb - ll2 + ct / 2, v52.Y);
                    Vector2 v56 = new Vector2(lpcon + lb - (bd - bted) / 2 / Math.Tan(bhta), v52.Y);
                    Vector2 v57 = new Vector2(lpcon + lb, bted / 2);
                    Vector2 v58 = new Vector2(v51.X, -v51.Y);
                    Vector2 v59 = new Vector2(v56.X, -v56.Y);
                    Vector2 v60 = new Vector2(v57.X, -v57.Y);
                    Vector2 v98 = new Vector2(v57.X, v56.Y);
                    //线段
                    Vector2[] Line58 = { v51, v52 };
                    fun.drawBLine(dxf, Line58, 0.3, contour);
                    Vector2[] Line60 = { v55, v56 };
                    fun.drawBLine(dxf, Line60, 0.3, contour);
                    Vector2[] Line61 = { v56, v57 };
                    fun.drawBLine(dxf, Line61, 0.3, contour);
                    Vector2[] Line62 = { v57, v60 };
                    fun.drawBLine(dxf, Line62, 0.3, contour);
                    Vector2[] Line63 = { v60, v59 };
                    fun.drawBLine(dxf, Line63, 0.3, contour);
                    Vector2[] Line64 = { v59, v58 };
                    fun.drawBLine(dxf, Line64, 0.3, contour);
                    Vector2[] Line65 = { v58, v51 };
                    fun.drawBLine(dxf, Line65, 0.3, contour);
                    Line Line93 = new Line(v56, v98);
                    Line93.Layer = dimensioning;
                    dxf.AddEntity(Line93);

                    //坐标
                    Vector2 v61 = new Vector2(v57.X, dconws / 2 + 1);//工件侧内侧
                    Vector2 v62 = new Vector2(v61.X - 1, dconws / 2);
                    Vector2 v63 = new Vector2(v57.X - ll1, v62.Y);
                    Vector2 v64 = new Vector2(v57.X - ll4, v63.Y);
                    Vector2 v65 = new Vector2(v64.X, dconws / 4);
                    Vector2 v66 = new Vector2(v51.X, v65.Y);
                    Vector2 v67 = new Vector2(v61.X, -v61.Y);
                    Vector2 v68 = new Vector2(v62.X, -v62.Y);
                    Vector2 v69 = new Vector2(v63.X, -v63.Y);
                    Vector2 v70 = new Vector2(v64.X, -v64.Y);
                    Vector2 v71 = new Vector2(v65.X, -v65.Y);
                    Vector2 v72 = new Vector2(v66.X, -v66.Y);
                    Vector2 v81 = new Vector2((v69.X + v70.X) / 2, v70.Y);
                    double lll = v63.X - v64.X;
                    double hhh = (v63.X - v64.X) / 2;
                    // 线段
                    Vector2[] Line67 = { v61, v62 };
                    fun.drawBLine(dxf, Line67, 0.3, contour);
                    LwPolyline Arc7 = new LwPolyline();
                    Arc7.Vertexes.Add(new LwPolylineVertex(v63));
                    Arc7.Vertexes.Add(new LwPolylineVertex(v64));
                    Arc7.Vertexes[0].Bulge = 2 * hhh / lll;
                    fun.PolyFill(dxf, Arc7, 0.3, contour);
                    Vector2[] Line70 = { v64, v65 };
                    fun.drawBLine(dxf, Line70, 0.3, contour);
                    Vector2[] Line71 = { v65, v66 };
                    fun.drawBLine(dxf, Line71, 0.3, contour);
                    Vector2[] Line72 = { v66, v72 };
                    fun.drawBLine(dxf, Line72, 0.3, contour);
                    Vector2[] Line73 = { v72, v71 };
                    fun.drawBLine(dxf, Line73, 0.3, contour);
                    Vector2[] Line74 = { v71, v70 };
                    fun.drawBLine(dxf, Line74, 0.3, contour);
                    LwPolyline Arc8 = new LwPolyline();
                    Arc8.Vertexes.Add(new LwPolylineVertex(v70));
                    Arc8.Vertexes.Add(new LwPolylineVertex(v69));
                    Arc8.Vertexes[0].Bulge = 2 * hhh / lll;
                    fun.PolyFill(dxf, Arc8, 0.3, contour);
                    Vector2[] Line76 = { v69, v68 };
                    fun.drawBLine(dxf, Line76, 0.3, contour);
                    Vector2[] Line77 = { v68, v67 };
                    fun.drawBLine(dxf, Line77, 0.3, contour);
                    Vector2[] Line78 = { v67, v61 };
                    fun.drawBLine(dxf, Line78, 0.3, contour);
                    Vector2[] Line79 = { v63, v69 };
                    fun.drawBLine(dxf, Line79, 0.3, contour);
                    Vector2[] Line80 = { v64, v70 };
                    fun.drawBLine(dxf, Line80, 0.3, contour);
                    Vector2[] Line81 = { v62, v68 };
                    fun.drawBLine(dxf, Line81, 0.3, contour);

                    //坐标
                    Vector2 v73 = new Vector2(v52.X, v52.Y - 1 * scale);//螺纹内部
                    Vector2 v74 = new Vector2(lpcon + lb - ll2 - xj2 / 2, v73.Y);
                    Vector2 v75 = new Vector2(lpcon + lb - ll2 - 2.5 * scale, v74.Y);
                    Vector2 v76 = new Vector2(lpcon + lb - ll2 + 2.5 * scale, v75.Y);
                    Vector2 v77 = new Vector2(lpcon + lb - ll2 + xj2 / 2, v76.Y);
                    Vector2 v78 = new Vector2(v55.X, v77.Y);
                    Vector2 v79 = new Vector2(v74.X, v62.Y);
                    Vector2 v80 = new Vector2(v77.X, v62.Y);
                    Vector2 v97 = new Vector2((v79.X + v80.X) / 2, v79.Y + xj2 / 2 / Math.Tan(118 * pi / 180 / 2));
                    double llll = xj2;
                    double hhhh = xj2 / 2 / Math.Tan(118 * pi / 180 / 2);
                    double xx = (v55.X + v52.X) / 2;//圆的x轴坐标
                    double yy = ((v77.X - xx) * (v77.X - xx) - (v55.X - xx) * (v55.X - xx) - v55.Y * v55.Y + v77.Y * v77.Y) / (2 * (v77.Y - v55.Y));//圆的y轴坐标
                    double rr = Math.Sqrt((v77.X - xx) * (v77.X - xx) + (v77.Y - yy) * (v77.Y - yy));//圆的半径
                    double lllll = Math.Sqrt((v55.X - v77.X) * (v55.X - v77.X) + (v55.Y - v77.Y) * (v55.Y - v77.Y));
                    double hhhhh = rr - (Math.Sqrt((rr * rr) - lllll * lllll / 4));
                    //线段
                    Vector2[] Line82 = { v73, v78 };
                    fun.drawBLine(dxf, Line82, 0.3, contour);
                    Vector2[] Line83 = { v74, v79 };
                    fun.drawBLine(dxf, Line83, 0.3, contour);
                    Vector2[] Line86 = { v80, v77 };
                    fun.drawBLine(dxf, Line86, 0.3, contour);
                    Vector2[] Line87 = { v52, v73 };
                    fun.drawBLine(dxf, Line87, 0.3, contour);
                    Vector2[] Line88 = { v55, v78 };
                    fun.drawBLine(dxf, Line88, 0.3, contour);
                    Vector2[] Line68 = { v62, v80 };
                    fun.drawBLine(dxf, Line68, 0.3, contour);
                    Vector2[] Line89 = { v63, v79 };
                    fun.drawBLine(dxf, Line89, 0.3, contour);
                    LwPolyline Arc9 = new LwPolyline();
                    Arc9.Vertexes.Add(new LwPolylineVertex(v79));
                    Arc9.Vertexes.Add(new LwPolylineVertex(v80));
                    Arc9.Vertexes[0].Bulge = 2 * hhhh / llll;
                    fun.PolyFill(dxf, Arc9, 0.3, contour);
                    LwPolyline Arc10 = new LwPolyline();
                    Arc10.Vertexes.Add(new LwPolylineVertex(v52));
                    Arc10.Vertexes.Add(new LwPolylineVertex(v74));
                    Arc10.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                    fun.PolyFill(dxf, Arc10, 0.3, contour);
                    LwPolyline Arc11 = new LwPolyline();
                    Arc11.Vertexes.Add(new LwPolylineVertex(v77));
                    Arc11.Vertexes.Add(new LwPolylineVertex(v55));
                    Arc11.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                    fun.PolyFill(dxf, Arc11, 0.3, contour);
                    //第一区域填充
                    LwPolyline hatchpoly1 = new LwPolyline();
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v73));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v74));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v79));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v63));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v64));
                    hatchpoly1.Vertexes[5].Bulge = 1;
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v65));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v66));
                    hatchpoly1.IsClosed = true;
                    String[] htype1 = new String[100];
                    Line[] hline1 = new Line[100];
                    Arc[] arc1 = new Arc[100];
                    int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst1; i++)
                    {
                        htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype1[i] == "Line")
                        {
                            hline1[i] = (Line)hatchpoly1.Explode()[i];
                        }
                        if (htype1[i] == "Arc")
                        {
                            arc1[i] = (Arc)hatchpoly1.Explode()[i];
                        }
                    }
                    fun.hatchsub1(dxf, htype1, hnumst1, 45, 10 * scale, hline1, arc1, hatching);

                    //第二区域填充
                    LwPolyline hatchpoly2 = new LwPolyline();
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v72));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v71));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v70));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v69));
                    hatchpoly2.Vertexes[2].Bulge = 1;
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v68));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v67));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v60));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v59));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v58));
                    hatchpoly2.IsClosed = true;
                    String[] htype2 = new String[100];
                    Line[] hline2 = new Line[100];
                    Arc[] arc2 = new Arc[100];
                    int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst2; i++)
                    {
                        htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype2[i] == "Line")
                        {
                            hline2[i] = (Line)hatchpoly2.Explode()[i];
                        }
                        if (htype2[i] == "Arc")
                        {
                            arc2[i] = (Arc)hatchpoly2.Explode()[i];
                        }
                    }
                    fun.hatchsub1(dxf, htype2, hnumst2, 45, 10 * scale, hline2, arc2, hatching);
                    //第三区域填充
                    LwPolyline hatchpoly3 = new LwPolyline();
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v77));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v78));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v55));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v56));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v57));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v61));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v62));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                    hatchpoly3.IsClosed = true;
                    String[] htype3 = new String[100];
                    Line[] hline3 = new Line[100];
                    int hnumst3 = hatchpoly3.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst3; i++)
                    {
                        htype3[i] = hatchpoly3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype3[i] == "Line")
                        {
                            hline3[i] = (Line)hatchpoly3.Explode()[i];
                        }
                    }
                    fun.hatchsubofline(dxf, htype3, hnumst3, 45, 5, hline3, hatching);
                    //文本样式
                    DimensionStyle dimensionStyle = fun.CreateDimStyle();
                    dimensionStyle.ArrowSize = 0.2;
                    dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                    dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
                    dimensionStyle.TextHeight = 1.0;
                    double offset = 10;
                    //标注
                    LinearDimension dim1 = new LinearDimension(new Line(new Vector2(-l1, -(d1 / 2 - l1 * Math.Tan(β) + (r1 - r1 * Math.Sin(β)) * r1 * Math.Tan(β) - r1 * Math.Cos(β))), v60), 3 * offset + (-(d1 / 2 - l1 * Math.Tan(β) + (r1 - r1 * Math.Sin(β)) * r1 * Math.Tan(β) - r1 * Math.Cos(β)) + v60.Y) / 2 - (-df / 2), 180, dimensionStyle);
                    dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                    dxf.AddEntity(dim1);

                    LinearDimension dim2 = new LinearDimension(new Line(new Vector2(lpcon, -df / 2 + 1), v60), offset + (v60.Y - (-df / 2 + 1)) / 2, 180, dimensionStyle);
                    dim2.UserText = "LB="+ Math.Round(lb / scale, 2);
                    dxf.AddEntity(dim2);

                    LinearDimension dim3 = new LinearDimension(new Line(v81, v60), 2 * offset + (v81.Y + v60.Y) - v58.Y, 180, dimensionStyle);
                    dim3.UserText = "LSC="+ Math.Round(lsc / scale, 2);
                    dxf.AddEntity(dim3);

                    LinearDimension dim4 = new LinearDimension(new Line(new Vector2(0, d1 / 2), v57), 4 * offset + df / 2 - 1 - (d1 / 2 + v57.Y) / 2, 0, dimensionStyle);
                    dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                    dxf.AddEntity(dim4);

                    LinearDimension dim5 = new LinearDimension(new Line(new Vector2(0, d1 / 2), v97), 3 * offset + df / 2 - 1 - (d1 / 2 + v97.Y) / 2, 0, dimensionStyle);
                    dim5.UserText = "LF="+ Math.Round(lf / scale, 2);
                    dxf.AddEntity(dim5);

                    LinearDimension dim6 = new LinearDimension(new Line(new Vector2(0, d1 / 2), new Vector2(lpcon, df / 2 - 1)), offset + (df / 2 - 1 - d1 / 2) / 2, 0, dimensionStyle);
                    dim6.UserText = "LPCON="+ Math.Round(lpcon / scale, 2);
                    dxf.AddEntity(dim6);

                    Angular2LineDimension dim7 = new Angular2LineDimension(new Line(v56, v98), new Line(v56, v57), offset, dimensionStyle);
                    dim7.UserText = String.Format("BHTA={0}°", bhta / (pi / 180));
                    dxf.AddEntity(dim7);

                    LinearDimension dim9 = new LinearDimension(new Line(new Vector2(lpcon - 1, df / 2), new Vector2(lpcon - 1, -df / 2)), offset, 270, dimensionStyle);
                    dim9.UserText = "DF="+ Math.Round(df / scale, 2);
                    dxf.AddEntity(dim9);

                    LinearDimension dim10 = new LinearDimension(new Line(v56, v59), 3 * offset + (v57.X - v56.X), 270, dimensionStyle);
                    dim10.UserText = "BD="+ Math.Round(bd / scale, 2);
                    dxf.AddEntity(dim10);

                    LinearDimension dim11 = new LinearDimension(new Line(v57, v60), 2 * offset, 270, dimensionStyle);
                    dim11.UserText = "BTED="+ Math.Round(bted / scale, 2);
                    dxf.AddEntity(dim11);

                    LinearDimension dim12 = new LinearDimension(new Line(v62, v68), offset + (v61.X - v62.X), 270, dimensionStyle);
                    dim12.UserText = "DCONWS="+ Math.Round(dconws / scale, 2);
                    dxf.AddEntity(dim12);

                    LinearDimension dim13 = new LinearDimension(new Line(v74, v77), offset, 0, dimensionStyle);
                    dim13.UserText = "DD3="+ Math.Round(dd3 / scale, 2);
                    dxf.AddEntity(dim13);
                    //图框
                    if (isframe == 1)
                    {
                        Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-l1 + oal / 2 - 210, d1 / 2 + 148.5 - d1 / 2));
                        fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                    }
                }
                //文件格式
                dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
                dxf.Save(path);
            }
            if (ccms1 == "ccs01")
            {
                double soal = Convert.ToDouble(data["l2"]) + Convert.ToDouble(data["l1"]) + Convert.ToDouble(data["l3"]) + Convert.ToDouble(data["lb"]);//总长度
                double scale = Convert.ToDouble(data["scale"]);//比例
                if (scale == 0)
                {
                    if (soal < 53.8)
                    {
                        scale = 5.0;
                    }
                    else if (soal < 67.25)
                    {
                        scale = 4.0;
                    }
                    else if (soal < 90)
                    {
                        scale = 3.0;
                    }
                    else if (soal < 134.5)
                    {
                        scale = 1.5;
                    }
                    else if (soal < 269)
                    {
                        scale = 1.0;
                    }
                    else if (soal < 359)
                    {
                        scale = 0.75;
                    }
                    else
                    {
                        scale = 0.5;
                    }
                }//比例判断
                double lb = Convert.ToDouble(data["lb"]) * scale;//体长
                double l1 = Convert.ToDouble(data["l1"]) * scale;
                double l3 = Convert.ToDouble(data["l3"]) * scale;
                double lpcon = 20 * scale;//连接伸出长度
                double lpr = 50 * scale;//伸出长度
                double l2 = Convert.ToDouble(data["l2"]) * scale;
                double oal = 96.5 * scale;//总长度
                //工件侧
                double ll1 = Convert.ToDouble(data["ll1"]) * scale;
                double ll4 = Convert.ToDouble(data["ll4"]) * scale;
                double lsc = (ll1 + ll4) / 2;//夹紧长度
                double dconws = Convert.ToDouble(data["dconws"]) * scale;//工件侧连接直径
                double bted = Convert.ToDouble(data["bted"]) * scale;//体锥度端径
                double bd = Convert.ToDouble(data["bd"]) * scale;//体直径
                double bhta = Convert.ToDouble(data["bhta"]) * pi / 180;//体半锥角
                double ll2 = Convert.ToDouble(data["ll2"]) * scale;
                double lf = lpr - ll2;//功能长度
                double dd3 = Convert.ToDouble(data["dd3"]) * scale;
                double p2 = Convert.ToDouble(data["p2"]) * scale;//螺距
                double xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                double ct = Convert.ToDouble(data["ct"]) * scale;
                //psc
                double df = Convert.ToDouble(data["df"]) * scale;//法兰直径
                double czc = Convert.ToDouble(data["czc"]);
                double l4 = Convert.ToDouble(data["l4"]) * scale;
                double l6 = Convert.ToDouble(data["l6"]) * scale;
                double D = Convert.ToDouble(data["d"]) * scale;
                double β = Convert.ToDouble(data["bb"]) * pi / 180;
                double β1 = Convert.ToDouble(data["b1"]) * pi / 180;
                if (ccms1 == "ccs01")//PSC
                {
                    if (czc == 32)
                    {
                        l1 = 2.5 * scale;
                        l2 = 19 * scale;
                        l3 = 15 * scale;
                        l4 = 1 * scale;
                        l6 = 6 * scale;
                        D = 22 * scale;
                        df = 32 * scale;
                        β = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                        lpcon = (l1 + l3);
                        β1 = 60 * pi / 180;
                    }
                    if (czc == 40)
                    {
                        l1 = 2.5 * scale;
                        l2 = 24 * scale;
                        l3 = 20 * scale;
                        l4 = 1.5 * scale;
                        l6 = 8 * scale;
                        D = 28 * scale;
                        df = 40 * scale;
                        β = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                        lpcon = (l1 + l3);
                        β1 = 60 * pi / 180;
                    }
                    if (czc == 50)
                    {
                        l1 = 3 * scale;
                        l2 = 30 * scale;
                        l3 = 20 * scale;
                        l4 = 1.5 * scale;
                        l6 = 10 * scale;
                        D = 35 * scale;
                        df = 50 * scale;
                        β = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                        lpcon = (l1 + l3);
                        β1 = 60 * pi / 180;
                    }
                    if (czc == 63)
                    {
                        l1 = 3 * scale;
                        l2 = 38 * scale;
                        l3 = 22 * scale;
                        l4 = 1.5 * scale;
                        l6 = 12 * scale;
                        D = 44 * scale;
                        df = 63 * scale;
                        β = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                        lpcon = (l1 + l3);
                        β1 = 60 * pi / 180;
                    }
                    if (czc == 80)
                    {
                        l1 = 3 * scale;
                        l2 = 48 * scale;
                        l3 = 30 * scale;
                        l4 = 1.5 * scale;
                        l6 = 12 * scale;
                        D = 55 * scale;
                        df = 80 * scale;
                        β = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                        lpcon = (l1 + l3);
                        β1 = 60 * pi / 180;
                    }
                    if (czc > 80)
                    {
                        l1 = 3 * scale;
                        l2 = 48 * scale;
                        l3 = 32 * scale;
                        l4 = 1.5 * scale;
                        l6 = 16 * scale;
                        D = 55 * scale;
                        df = 100 * scale;
                        β = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                        lpcon = (l1 + l3);
                        β1 = 60 * pi / 180;
                    }
                }
                string ccms3 = "ZYL10";//工件侧形状
                string ccms2 = Convert.ToString(data["ccms2"]);//工件侧大小
                if (ccms3 == "ZYL10" && ccms2 == "6")
                {
                    dconws = 6 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 25 * scale;
                    dd3 = 6 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 15 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l2 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "8")
                {
                    dconws = 8 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 28 * scale;
                    dd3 = 8 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 20 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l2 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "10")
                {
                    dconws = 10 * scale;
                    ll1 = 39 * scale;
                    ll2 = 20 * scale;
                    ll4 = 41 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 35 * scale;
                    dd3 = 10 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 25 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l2 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "12")
                {
                    dconws = 12 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 42 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 12 * scale;//沉头
                    bted = 30 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l2 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "14")
                {
                    dconws = 14 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 44 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 14 * scale;//沉头
                    bted = 32 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l2 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "16")
                {
                    dconws = 16 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 48 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 16 * scale;//沉头
                    bted = 36 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l2 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "18")
                {
                    dconws = 18 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 50 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 18 * scale;//沉头
                    bted = 38 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l2 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "20")
                {
                    dconws = 20 * scale;
                    ll1 = 49 * scale;
                    ll2 = 25 * scale;
                    ll4 = 51 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 52 * scale;
                    dd3 = 16 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 20 * scale;//沉头
                    bted = 40 * scale;
                    bhta = 25 * pi / 180;
                    lb = 70 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l2 + lpr;//总长度
                }
                double isframe = Convert.ToDouble(data["isframe"]);
                //判断锥柄skg
                if (ccms1 == "ccs01")
                {
                    //坐标
                    Vector2 v2 = new Vector2(-l2 + l4, D / 2);//机床侧
                    Vector2 v1 = new Vector2(-l2, D / 2 - l4 / Math.Tan(β1));
                    Vector2 v3 = new Vector2(0, v2.Y + (l2 - l1) * Math.Tan(β));
                    Vector2 v4 = new Vector2(l1, v3.Y);
                    Vector2 v5 = new Vector2(v4.X, -v4.Y);
                    Vector2 v6 = new Vector2(v3.X, -v3.Y);
                    Vector2 v7 = new Vector2(v2.X, -v2.Y);
                    Vector2 v8 = new Vector2(v1.X, -v1.Y);
                    //线段
                    Vector2[] Line1 = { v2, v3 };
                    fun.drawBLine(dxf, Line1, 0.3, contour);
                    Vector2[] Line2 = { v3, v4 };
                    fun.drawBLine(dxf, Line2, 0.3, contour);
                    Vector2[] Line3 = { v4, v5 };
                    fun.drawBLine(dxf, Line3, 0.3, contour);
                    Vector2[] Line4 = { v5, v6 };
                    fun.drawBLine(dxf, Line4, 0.3, contour);
                    Vector2[] Line5 = { v6, v7 };
                    fun.drawBLine(dxf, Line5, 0.3, contour);
                    Vector2[] Line6 = { v8, v1 };
                    fun.drawBLine(dxf, Line6, 0.3, contour);
                    Vector2[] Line7 = { v2, v7 };
                    fun.drawBLine(dxf, Line7, 0.3, contour);
                    Vector2[] Line8 = { v3, v6 };
                    fun.drawBLine(dxf, Line8, 0.3, contour);
                    Vector2[] Line9 = { v1, v2 };
                    fun.drawBLine(dxf, Line9, 0.3, contour);
                    Vector2[] Line10 = { v7, v8 };
                    fun.drawBLine(dxf, Line10, 0.3, contour);


                    //坐标
                    Vector2 v9 = new Vector2(l1, df / 2 - 1);//法兰外侧
                    Vector2 v10 = new Vector2(l1 + 1, df / 2);
                    Vector2 v17 = new Vector2(lpcon - 1, v10.Y);
                    Vector2 v18 = new Vector2(lpcon, v10.Y - 1);
                    Vector2 v19 = new Vector2(v9.X, -v9.Y);
                    Vector2 v20 = new Vector2(v10.X, -v10.Y);
                    Vector2 v27 = new Vector2(v17.X, -v17.Y);
                    Vector2 v28 = new Vector2(v18.X, -v18.Y);
                    //线段
                    Vector2[] Line19 = { v9, v10 };
                    fun.drawBLine(dxf, Line19, 0.3, contour);
                    Vector2[] Line24 = { v10, v17 };
                    fun.drawBLine(dxf, Line24, 0.3, contour);
                    Vector2[] Line25 = { v17, v18 };
                    fun.drawBLine(dxf, Line25, 0.3, contour);
                    Vector2[] Line26 = { v18, v28 };
                    fun.drawBLine(dxf, Line26, 0.3, contour);
                    Vector2[] Line27 = { v28, v27 };
                    fun.drawBLine(dxf, Line27, 0.3, contour);
                    Vector2[] Line32 = { v27, v20 };
                    fun.drawBLine(dxf, Line32, 0.3, contour);
                    Vector2[] Line33 = { v20, v19 };
                    fun.drawBLine(dxf, Line33, 0.3, contour);
                    Vector2[] Line34 = { v19, v9 };
                    fun.drawBLine(dxf, Line34, 0.3, contour);
                }
                //工件侧
                if (ccms3 == "ZYL10")
                {
                    //坐标
                    Vector2 v51 = new Vector2(lpcon, bd / 2);//工件侧外侧
                    Vector2 v52 = new Vector2(lpcon + lb - ll2 - ct / 2, v51.Y);
                    Vector2 v55 = new Vector2(lpcon + lb - ll2 + ct / 2, v52.Y);
                    Vector2 v56 = new Vector2(lpcon + lb - (bd - bted) / 2 / Math.Tan(bhta), v52.Y);
                    Vector2 v57 = new Vector2(lpcon + lb, bted / 2);
                    Vector2 v58 = new Vector2(v51.X, -v51.Y);
                    Vector2 v59 = new Vector2(v56.X, -v56.Y);
                    Vector2 v60 = new Vector2(v57.X, -v57.Y);
                    Vector2 v98 = new Vector2(v57.X, v56.Y);
                    //线段
                    Vector2[] Line58 = { v51, v52 };
                    fun.drawBLine(dxf, Line58, 0.3, contour);
                    Vector2[] Line60 = { v55, v56 };
                    fun.drawBLine(dxf, Line60, 0.3, contour);
                    Vector2[] Line61 = { v56, v57 };
                    fun.drawBLine(dxf, Line61, 0.3, contour);
                    Vector2[] Line62 = { v57, v60 };
                    fun.drawBLine(dxf, Line62, 0.3, contour);
                    Vector2[] Line63 = { v60, v59 };
                    fun.drawBLine(dxf, Line63, 0.3, contour);
                    Vector2[] Line64 = { v59, v58 };
                    fun.drawBLine(dxf, Line64, 0.3, contour);
                    Vector2[] Line65 = { v58, v51 };
                    fun.drawBLine(dxf, Line65, 0.3, contour);
                    Line Line93 = new Line(v56, v98);
                    Line93.Layer = dimensioning;
                    dxf.AddEntity(Line93);

                    //坐标
                    Vector2 v61 = new Vector2(v57.X, dconws / 2 + 1);//工件侧内侧
                    Vector2 v62 = new Vector2(v61.X - 1, dconws / 2);
                    Vector2 v63 = new Vector2(v57.X - ll1, v62.Y);
                    Vector2 v64 = new Vector2(v57.X - ll4, v63.Y);
                    Vector2 v65 = new Vector2(v64.X, dconws / 4);
                    Vector2 v66 = new Vector2(v51.X, v65.Y);
                    Vector2 v67 = new Vector2(v61.X, -v61.Y);
                    Vector2 v68 = new Vector2(v62.X, -v62.Y);
                    Vector2 v69 = new Vector2(v63.X, -v63.Y);
                    Vector2 v70 = new Vector2(v64.X, -v64.Y);
                    Vector2 v71 = new Vector2(v65.X, -v65.Y);
                    Vector2 v72 = new Vector2(v66.X, -v66.Y);
                    Vector2 v81 = new Vector2((v69.X + v70.X) / 2, v70.Y);
                    double lll = v63.X - v64.X;
                    double hhh = (v63.X - v64.X) / 2;
                    // 线段
                    Vector2[] Line67 = { v61, v62 };
                    fun.drawBLine(dxf, Line67, 0.3, contour);
                    LwPolyline Arc7 = new LwPolyline();
                    Arc7.Vertexes.Add(new LwPolylineVertex(v63));
                    Arc7.Vertexes.Add(new LwPolylineVertex(v64));
                    Arc7.Vertexes[0].Bulge = 2 * hhh / lll;
                    fun.PolyFill(dxf, Arc7, 0.3, contour);
                    Vector2[] Line70 = { v64, v65 };
                    fun.drawBLine(dxf, Line70, 0.3, contour);
                    Vector2[] Line71 = { v65, v66 };
                    fun.drawBLine(dxf, Line71, 0.3, contour);
                    Vector2[] Line72 = { v66, v72 };
                    fun.drawBLine(dxf, Line72, 0.3, contour);
                    Vector2[] Line73 = { v72, v71 };
                    fun.drawBLine(dxf, Line73, 0.3, contour);
                    Vector2[] Line74 = { v71, v70 };
                    fun.drawBLine(dxf, Line74, 0.3, contour);
                    LwPolyline Arc8 = new LwPolyline();
                    Arc8.Vertexes.Add(new LwPolylineVertex(v70));
                    Arc8.Vertexes.Add(new LwPolylineVertex(v69));
                    Arc8.Vertexes[0].Bulge = 2 * hhh / lll;
                    fun.PolyFill(dxf, Arc8, 0.3, contour);
                    Vector2[] Line76 = { v69, v68 };
                    fun.drawBLine(dxf, Line76, 0.3, contour);
                    Vector2[] Line77 = { v68, v67 };
                    fun.drawBLine(dxf, Line77, 0.3, contour);
                    Vector2[] Line78 = { v67, v61 };
                    fun.drawBLine(dxf, Line78, 0.3, contour);
                    Vector2[] Line79 = { v63, v69 };
                    fun.drawBLine(dxf, Line79, 0.3, contour);
                    Vector2[] Line80 = { v64, v70 };
                    fun.drawBLine(dxf, Line80, 0.3, contour);
                    Vector2[] Line81 = { v62, v68 };
                    fun.drawBLine(dxf, Line81, 0.3, contour);

                    //坐标
                    Vector2 v73 = new Vector2(v52.X, v52.Y - 1 * scale);//螺纹内部
                    Vector2 v74 = new Vector2(lpcon + lb - ll2 - xj2 / 2, v73.Y);
                    Vector2 v75 = new Vector2(lpcon + lb - ll2 - 2.5 * scale, v74.Y);
                    Vector2 v76 = new Vector2(lpcon + lb - ll2 + 2.5 * scale, v75.Y);
                    Vector2 v77 = new Vector2(lpcon + lb - ll2 + xj2 / 2, v76.Y);
                    Vector2 v78 = new Vector2(v55.X, v77.Y);
                    Vector2 v79 = new Vector2(v74.X, v62.Y);
                    Vector2 v80 = new Vector2(v77.X, v62.Y);
                    Vector2 v97 = new Vector2((v79.X + v80.X) / 2, v79.Y + xj2 / 2 / Math.Tan(118 * pi / 180 / 2));
                    double llll = xj2;
                    double hhhh = xj2 / 2 / Math.Tan(118 * pi / 180 / 2);
                    double xx = (v55.X + v52.X) / 2;//圆的x轴坐标
                    double yy = ((v77.X - xx) * (v77.X - xx) - (v55.X - xx) * (v55.X - xx) - v55.Y * v55.Y + v77.Y * v77.Y) / (2 * (v77.Y - v55.Y));//圆的y轴坐标
                    double rr = Math.Sqrt((v77.X - xx) * (v77.X - xx) + (v77.Y - yy) * (v77.Y - yy));//圆的半径
                    double lllll = Math.Sqrt((v55.X - v77.X) * (v55.X - v77.X) + (v55.Y - v77.Y) * (v55.Y - v77.Y));
                    double hhhhh = rr - (Math.Sqrt((rr * rr) - lllll * lllll / 4));
                    //线段
                    Vector2[] Line82 = { v73, v78 };
                    fun.drawBLine(dxf, Line82, 0.3, contour);
                    Vector2[] Line83 = { v74, v79 };
                    fun.drawBLine(dxf, Line83, 0.3, contour);
                    Vector2[] Line86 = { v80, v77 };
                    fun.drawBLine(dxf, Line86, 0.3, contour);
                    Vector2[] Line87 = { v52, v73 };
                    fun.drawBLine(dxf, Line87, 0.3, contour);
                    Vector2[] Line88 = { v55, v78 };
                    fun.drawBLine(dxf, Line88, 0.3, contour);
                    Vector2[] Line68 = { v62, v80 };
                    fun.drawBLine(dxf, Line68, 0.3, contour);
                    Vector2[] Line89 = { v63, v79 };
                    fun.drawBLine(dxf, Line89, 0.3, contour);
                    LwPolyline Arc9 = new LwPolyline();
                    Arc9.Vertexes.Add(new LwPolylineVertex(v79));
                    Arc9.Vertexes.Add(new LwPolylineVertex(v80));
                    Arc9.Vertexes[0].Bulge = 2 * hhhh / llll;
                    fun.PolyFill(dxf, Arc9, 0.3, contour);
                    LwPolyline Arc10 = new LwPolyline();
                    Arc10.Vertexes.Add(new LwPolylineVertex(v52));
                    Arc10.Vertexes.Add(new LwPolylineVertex(v74));
                    Arc10.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                    fun.PolyFill(dxf, Arc10, 0.3, contour);
                    LwPolyline Arc11 = new LwPolyline();
                    Arc11.Vertexes.Add(new LwPolylineVertex(v77));
                    Arc11.Vertexes.Add(new LwPolylineVertex(v55));
                    Arc11.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                    fun.PolyFill(dxf, Arc11, 0.3, contour);
                    //第一区域填充
                    LwPolyline hatchpoly1 = new LwPolyline();
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v73));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v74));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v79));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v63));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v64));
                    hatchpoly1.Vertexes[5].Bulge = 1;
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v65));
                    hatchpoly1.Vertexes.Add(new LwPolylineVertex(v66));
                    hatchpoly1.IsClosed = true;
                    String[] htype1 = new String[100];
                    Line[] hline1 = new Line[100];
                    Arc[] arc1 = new Arc[100];
                    int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst1; i++)
                    {
                        htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype1[i] == "Line")
                        {
                            hline1[i] = (Line)hatchpoly1.Explode()[i];
                        }
                        if (htype1[i] == "Arc")
                        {
                            arc1[i] = (Arc)hatchpoly1.Explode()[i];
                        }
                    }
                    fun.hatchsub1(dxf, htype1, hnumst1, 45, 10 * scale, hline1, arc1, hatching);

                    //第二区域填充
                    LwPolyline hatchpoly2 = new LwPolyline();
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v72));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v71));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v70));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v69));
                    hatchpoly2.Vertexes[2].Bulge = 1;
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v68));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v67));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v60));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v59));
                    hatchpoly2.Vertexes.Add(new LwPolylineVertex(v58));
                    hatchpoly2.IsClosed = true;
                    String[] htype2 = new String[100];
                    Line[] hline2 = new Line[100];
                    Arc[] arc2 = new Arc[100];
                    int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst2; i++)
                    {
                        htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype2[i] == "Line")
                        {
                            hline2[i] = (Line)hatchpoly2.Explode()[i];
                        }
                        if (htype2[i] == "Arc")
                        {
                            arc2[i] = (Arc)hatchpoly2.Explode()[i];
                        }
                    }
                    fun.hatchsub1(dxf, htype2, hnumst2, 45, 10 * scale, hline2, arc2, hatching);
                    //第三区域填充
                    LwPolyline hatchpoly3 = new LwPolyline();
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v77));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v78));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v55));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v56));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v57));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v61));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v62));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                    hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                    hatchpoly3.IsClosed = true;
                    String[] htype3 = new String[100];
                    Line[] hline3 = new Line[100];
                    int hnumst3 = hatchpoly3.Explode().Count;  //记录爆炸后，线段有多少
                    for (int i = 0; i < hnumst3; i++)
                    {
                        htype3[i] = hatchpoly3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                        if (htype3[i] == "Line")
                        {
                            hline3[i] = (Line)hatchpoly3.Explode()[i];
                        }
                    }
                    fun.hatchsubofline(dxf, htype3, hnumst3, 45, 5, hline3, hatching);
                    //文本样式
                    DimensionStyle dimensionStyle = fun.CreateDimStyle();
                    dimensionStyle.ArrowSize = 0.2;
                    dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                    dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
                    dimensionStyle.TextHeight = 1.0;
                    double offset = 10;
                    //标注
                    LinearDimension dim1 = new LinearDimension(new Line(new Vector2(-l2, -(D / 2 - l4 / Math.Tan(β1))), v60), 3 * offset + ((-(D / 2 - l4 / Math.Tan(β1))) + v60.Y) / 2 - (-df / 2), 180, dimensionStyle);
                    dim1.UserText = "OAL="+ Math.Round((l2 + l1 + l3 + lb) / scale, 2);
                    dxf.AddEntity(dim1);

                    LinearDimension dim2 = new LinearDimension(new Line(new Vector2(lpcon, -df / 2 + 1), v60), offset + (v60.Y - (-df / 2 + 1)) / 2, 180, dimensionStyle);
                    dim2.UserText = "LB="+ Math.Round(lb / scale, 2);
                    dxf.AddEntity(dim2);

                    LinearDimension dim3 = new LinearDimension(new Line(v81, v60), offset + (v81.Y + v60.Y) / 2 - v58.Y, 180, dimensionStyle);
                    dim3.UserText = "LSC="+ Math.Round(lsc / scale, 2);
                    dxf.AddEntity(dim3);

                    LinearDimension dim4 = new LinearDimension(new Line(new Vector2(0, df / 2), v57), 4 * offset + df / 2 - 1 - (df / 2 + v57.Y) / 2, 0, dimensionStyle);
                    dim4.UserText = "LPR="+ Math.Round((l3 + l1 + lb) / scale, 2);
                    dxf.AddEntity(dim4);

                    LinearDimension dim5 = new LinearDimension(new Line(new Vector2(0, df / 2), v97), 3 * offset + df / 2 - 1 - (df / 2 + v97.Y) / 2, 0, dimensionStyle);
                    dim5.UserText = "LF="+ Math.Round(lf / scale, 2);
                    dxf.AddEntity(dim5);

                    LinearDimension dim6 = new LinearDimension(new Line(new Vector2(0, df / 2), new Vector2(lpcon, df / 2 - 1)), offset + (df / 2 - 1 - df / 2) / 2, 0, dimensionStyle);
                    dim6.UserText = "LPCON="+ Math.Round((l1 + l3) / scale, 2);
                    dxf.AddEntity(dim6);

                    Angular2LineDimension dim7 = new Angular2LineDimension(new Line(v56, v98), new Line(v56, v57), offset, dimensionStyle);
                    dim7.UserText = String.Format("BHTA={0}°", bhta / (pi / 180));
                    dxf.AddEntity(dim7);

                    LinearDimension dim9 = new LinearDimension(new Line(new Vector2(lpcon - 1, df / 2), new Vector2(lpcon - 1, -df / 2)), offset, 270, dimensionStyle);
                    dim9.UserText = "DF="+ Math.Round(df / scale, 2);
                    dxf.AddEntity(dim9);

                    LinearDimension dim10 = new LinearDimension(new Line(v56, v59), 3 * offset + (v57.X - v56.X), 270, dimensionStyle);
                    dim10.UserText = "BD="+ Math.Round(bd / scale, 2);
                    dxf.AddEntity(dim10);

                    LinearDimension dim11 = new LinearDimension(new Line(v57, v60), 2 * offset, 270, dimensionStyle);
                    dim11.UserText = "BTED="+ Math.Round(bted / scale, 2);
                    dxf.AddEntity(dim11);

                    LinearDimension dim12 = new LinearDimension(new Line(v62, v68), offset + (v61.X - v62.X), 270, dimensionStyle);
                    dim12.UserText = "DCONWS="+ Math.Round(dconws / scale, 2);
                    dxf.AddEntity(dim12);

                    LinearDimension dim13 = new LinearDimension(new Line(v74, v77), offset, 0, dimensionStyle);
                    dim13.UserText = "DD3="+ Math.Round(dd3 / scale, 2);
                    dxf.AddEntity(dim13);
                    //图框
                    if (isframe == 1)
                    {
                        Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-l1 + oal / 2 - 210, df / 2 + 148.5 - df / 2));
                        fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                    }
                }
                //文件格式
                dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
                dxf.Save(path);
            }
            if (ccms1 == "meg10")
            {
                double soal = Convert.ToDouble(data["l3"]) + Convert.ToDouble(data["lpcon"]) + Convert.ToDouble(data["lb"]);//总长度
                double sdb = Convert.ToDouble(data["db"]);//锥柄大径
                double scale = Convert.ToDouble(data["scale"]);//比例
                double a = Convert.ToDouble(data["a"]) * scale;
                double lb = Convert.ToDouble(data["lb"]) * scale;//体长
                double lpcon = Convert.ToDouble(data["lpcon"]) * scale;//连接伸出长度
                if (lpcon == 0)
                {
                    lpcon = a;
                }
                double lpr = lpcon + lb;//伸出长度
                double l3 = Convert.ToDouble(data["l3"]) * scale;
                double l4 = l3 + a;
                double oal = l3 + lpr;//总长度
                //工件侧
                double ll1 = Convert.ToDouble(data["ll1"]) * scale;
                double ll4 = Convert.ToDouble(data["ll4"]) * scale;
                double lsc = (ll1 + ll4) / 2;//夹紧长度
                double dconws = Convert.ToDouble(data["dconws"]) * scale;//工件侧连接直径
                double bted = Convert.ToDouble(data["bted"]) * scale;//体锥度端径
                double bd = Convert.ToDouble(data["bd"]) * scale;//体直径
                double bhta = Convert.ToDouble(data["bhta"]) * pi / 180;//体半锥角
                double ll2 = Convert.ToDouble(data["ll2"]) * scale;
                double lf = lpr - ll2;//功能长度
                double dd3 = Convert.ToDouble(data["dd3"]) * scale;
                double p2 = Convert.ToDouble(data["p2"]) * scale;//螺距
                double xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                double ct = Convert.ToDouble(data["ct"]) * scale;
                ////meg
                double d2 = Convert.ToDouble(data["d2"]) * scale;
                double d3 = Convert.ToDouble(data["d3"]) * scale;
                double b = Convert.ToDouble(data["b"]) * scale;
                double R = Convert.ToDouble(data["rr"]) * scale;
                double e = Convert.ToDouble(data["e"]) * scale;
                double D = Convert.ToDouble(data["dd"]) * scale;
                double db = Convert.ToDouble(data["db"]) * scale;
                double r = Convert.ToDouble(data["r"]) * scale;
                double c = Convert.ToDouble(data["c"]) * scale;
                double β1 = Convert.ToDouble(data["b1"]) * scale;
                double d = Convert.ToDouble(data["d"]) * scale;
                double t = Convert.ToDouble(data["t"]) * scale;
                double tg = Convert.ToDouble(data["tg"]) * scale;//锥度
                double czc = Convert.ToDouble(data["czc"]);
                if (scale == 0 && ccms1 == "meg10" && czc < 80)
                {
                    if (soal < 68 && sdb < 31.2)
                    {
                        scale = 5.0;
                    }
                    else if (soal < 85 && sdb < 39)
                    {
                        scale = 4.0;
                    }
                    else if (soal < 113 && sdb < 52)
                    {
                        scale = 3.0;
                    }
                    else if (soal < 226 && sdb < 104)
                    {
                        scale = 1.5;
                    }
                    else if (soal < 340 && sdb < 156)
                    {
                        scale = 1.0;
                    }
                    else if (soal < 453 && sdb < 208)
                    {
                        scale = 0.75;
                    }
                    else
                    {
                        scale = 0.5;
                    }
                }//比例判断
                if (scale == 0 && ccms1 == "meg10" && czc > 6)
                {
                    if (soal < 300)
                    {
                        scale = 0.5;
                    }
                    else if (soal < 375)
                    {
                        scale = 0.4;
                    }
                    else if (soal < 500)
                    {
                        scale = 0.3;
                    }
                    else if (soal < 600)
                    {
                        scale = 0.25;
                    }
                }//比例判断
                if (ccms1 == "meg10")//英制
                {
                    if (czc == 4)
                    {
                        D = 4 * scale;
                        db = 4.1 * scale;
                        a = 2 * scale;
                        β1 = 8 * scale;
                        l3 = 23 * scale;
                        l4 = 25 * scale;
                        d = 2.9 * scale;
                        t = 2 * scale;
                        tg = 0.05 * scale;
                    }
                    if (czc == 6)
                    {
                        D = 6 * scale;
                        db = 6.2 * scale;
                        a = 3 * scale;
                        β1 = 8 * scale;
                        l3 = 32 * scale;
                        l4 = 35 * scale;
                        d = 4.4 * scale;
                        t = 3 * scale;
                        tg = 0.05 * scale;
                    }
                    if (czc == 80)
                    {
                        d2 = 69 * scale;
                        d3 = 67 * scale;
                        b = 26 * scale;
                        R = 24 * scale;
                        e = 48 * scale;
                        D = 80 * scale;
                        db = 80.4 * scale;
                        l3 = 220 * scale;
                        a = 8 * scale;
                        r = 5 * scale;
                        c = 24 * scale;
                        l4 = l3 + a;
                        β1 = 8 * scale;
                        tg = 0.05 * scale;
                    }
                    if (czc == 100)
                    {
                        d2 = 87 * scale;
                        d3 = 85 * scale;
                        b = 32 * scale;
                        R = 30 * scale;
                        e = 58 * scale;
                        D = 100 * scale;
                        db = 100.5 * scale;
                        l3 = 260 * scale;
                        a = 10 * scale;
                        r = 5 * scale;
                        c = 28 * scale;
                        l4 = l3 + a;
                        β1 = 8 * scale;
                        tg = 0.05 * scale;
                    }
                    if (czc == 120)
                    {
                        d2 = 105 * scale;
                        d3 = 102 * scale;
                        b = 38 * scale;
                        R = 36 * scale;
                        e = 68 * scale;
                        D = 120 * scale;
                        db = 120.6 * scale;
                        l3 = 300 * scale;
                        a = 12 * scale;
                        r = 6 * scale;
                        c = 32 * scale;
                        l4 = l3 + a;
                        β1 = 8 * scale;
                        tg = 0.05 * scale;
                    }
                    if (czc == 160)
                    {
                        d2 = 141 * scale;
                        d3 = 138 * scale;
                        b = 50 * scale;
                        R = 48 * scale;
                        e = 88 * scale;
                        D = 160 * scale;
                        db = 160.8 * scale;
                        l3 = 380 * scale;
                        a = 16 * scale;
                        r = 8 * scale;
                        c = 40 * scale;
                        l4 = l3 + a;
                        β1 = 8 * scale;
                        tg = 0.05 * scale;
                    }
                    if (czc == 200)
                    {
                        d2 = 177 * scale;
                        d3 = 174 * scale;
                        b = 62 * scale;
                        R = 60 * scale;
                        e = 108 * scale;
                        D = 200 * scale;
                        db = 201 * scale;
                        l3 = 460 * scale;
                        a = 20 * scale;
                        r = 10 * scale;
                        c = 48 * scale;
                        l4 = l3 + a;
                        β1 = 8 * scale;
                        tg = 0.05 * scale;
                    }
                }
                string ccms3 = "ZYL10";//工件侧形状
                string ccms2 = Convert.ToString(data["ccms2"]);//工件侧大小
                if (ccms3 == "ZYL10" && ccms2 == "6")
                {
                    dconws = 6 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 25 * scale;
                    dd3 = 6 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 15 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "8")
                {
                    dconws = 8 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 28 * scale;
                    dd3 = 8 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 20 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "10")
                {
                    dconws = 10 * scale;
                    ll1 = 39 * scale;
                    ll2 = 20 * scale;
                    ll4 = 41 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 35 * scale;
                    dd3 = 10 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 25 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "12")
                {
                    dconws = 12 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 42 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 12 * scale;//沉头
                    bted = 30 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "14")
                {
                    dconws = 14 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 44 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 14 * scale;//沉头
                    bted = 32 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "16")
                {
                    dconws = 16 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 48 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 16 * scale;//沉头
                    bted = 36 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "18")
                {
                    dconws = 18 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 50 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 18 * scale;//沉头
                    bted = 38 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "20")
                {
                    dconws = 20 * scale;
                    ll1 = 49 * scale;
                    ll2 = 25 * scale;
                    ll4 = 51 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 52 * scale;
                    dd3 = 16 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 20 * scale;//沉头
                    bted = 40 * scale;
                    bhta = 25 * pi / 180;
                    lb = 70 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                double isframe = Convert.ToDouble(data["isframe"]);
                //判断锥柄skg
                if (ccms1 == "meg10")
                {
                    if (czc == 4 || czc == 6)
                    {   //坐标
                        Vector2 v101 = new Vector2(-l3, d / 2);//无扁尾机床侧
                        Vector2 v102 = new Vector2(0, D / 2);
                        Vector2 v103 = new Vector2(a, db / 2);
                        Vector2 v104 = new Vector2(v103.X, -v103.Y);
                        Vector2 v105 = new Vector2(v102.X, -v102.Y);
                        Vector2 v106 = new Vector2(v101.X, -v101.Y);
                        //线段
                        Vector2[] Line1 = { v101, v102 };
                        fun.drawBLine(dxf, Line1, 0.3, contour);
                        Vector2[] Line2 = { v102, v103 };
                        fun.drawBLine(dxf, Line2, 0.3, contour);
                        Vector2[] Line3 = { v103, v104 };
                        fun.drawBLine(dxf, Line3, 0.3, contour);
                        Vector2[] Line4 = { v104, v105 };
                        fun.drawBLine(dxf, Line4, 0.3, contour);
                        Vector2[] Line5 = { v105, v106 };
                        fun.drawBLine(dxf, Line5, 0.3, contour);
                        Vector2[] Line6 = { v106, v101 };
                        fun.drawBLine(dxf, Line6, 0.3, contour);
                        //工件侧
                        if (ccms3 == "ZYL10")
                        {
                            //坐标
                            Vector2 v51 = new Vector2(a, bd / 2);//工件侧外侧
                            Vector2 v52 = new Vector2(a + lb - ll2 - ct / 2, v51.Y);
                            Vector2 v55 = new Vector2(a + lb - ll2 + ct / 2, v52.Y);
                            Vector2 v56 = new Vector2(a + lb - (bd - bted) / 2 / Math.Tan(bhta), v52.Y);
                            Vector2 v57 = new Vector2(a + lb, bted / 2);
                            Vector2 v58 = new Vector2(v51.X, -v51.Y);
                            Vector2 v59 = new Vector2(v56.X, -v56.Y);
                            Vector2 v60 = new Vector2(v57.X, -v57.Y);
                            Vector2 v98 = new Vector2(v57.X, v56.Y);
                            //线段
                            Vector2[] Line58 = { v51, v52 };
                            fun.drawBLine(dxf, Line58, 0.3, contour);
                            Vector2[] Line60 = { v55, v56 };
                            fun.drawBLine(dxf, Line60, 0.3, contour);
                            Vector2[] Line61 = { v56, v57 };
                            fun.drawBLine(dxf, Line61, 0.3, contour);
                            Vector2[] Line62 = { v57, v60 };
                            fun.drawBLine(dxf, Line62, 0.3, contour);
                            Vector2[] Line63 = { v60, v59 };
                            fun.drawBLine(dxf, Line63, 0.3, contour);
                            Vector2[] Line64 = { v59, v58 };
                            fun.drawBLine(dxf, Line64, 0.3, contour);
                            Vector2[] Line65 = { v58, v51 };
                            fun.drawBLine(dxf, Line65, 0.3, contour);
                            Line Line93 = new Line(v56, v98);
                            Line93.Layer = dimensioning;
                            dxf.AddEntity(Line93);

                            //坐标
                            Vector2 v61 = new Vector2(v57.X, dconws / 2 + 1);//工件侧内侧
                            Vector2 v62 = new Vector2(v61.X - 1, dconws / 2);
                            Vector2 v63 = new Vector2(v57.X - ll1, v62.Y);
                            Vector2 v64 = new Vector2(v57.X - ll4, v63.Y);
                            Vector2 v65 = new Vector2(v64.X, dconws / 4);
                            Vector2 v66 = new Vector2(v51.X, v65.Y);
                            Vector2 v67 = new Vector2(v61.X, -v61.Y);
                            Vector2 v68 = new Vector2(v62.X, -v62.Y);
                            Vector2 v69 = new Vector2(v63.X, -v63.Y);
                            Vector2 v70 = new Vector2(v64.X, -v64.Y);
                            Vector2 v71 = new Vector2(v65.X, -v65.Y);
                            Vector2 v72 = new Vector2(v66.X, -v66.Y);
                            Vector2 v81 = new Vector2((v69.X + v70.X) / 2, v70.Y);
                            double lll = v63.X - v64.X;
                            double hhh = (v63.X - v64.X) / 2;
                            // 线段
                            Vector2[] Line67 = { v61, v62 };
                            fun.drawBLine(dxf, Line67, 0.3, contour);
                            LwPolyline Arc7 = new LwPolyline();
                            Arc7.Vertexes.Add(new LwPolylineVertex(v63));
                            Arc7.Vertexes.Add(new LwPolylineVertex(v64));
                            Arc7.Vertexes[0].Bulge = 2 * hhh / lll;
                            fun.PolyFill(dxf, Arc7, 0.3, contour);
                            Vector2[] Line70 = { v64, v65 };
                            fun.drawBLine(dxf, Line70, 0.3, contour);
                            Vector2[] Line71 = { v65, v66 };
                            fun.drawBLine(dxf, Line71, 0.3, contour);
                            Vector2[] Line72 = { v66, v72 };
                            fun.drawBLine(dxf, Line72, 0.3, contour);
                            Vector2[] Line73 = { v72, v71 };
                            fun.drawBLine(dxf, Line73, 0.3, contour);
                            Vector2[] Line74 = { v71, v70 };
                            fun.drawBLine(dxf, Line74, 0.3, contour);
                            LwPolyline Arc8 = new LwPolyline();
                            Arc8.Vertexes.Add(new LwPolylineVertex(v70));
                            Arc8.Vertexes.Add(new LwPolylineVertex(v69));
                            Arc8.Vertexes[0].Bulge = 2 * hhh / lll;
                            fun.PolyFill(dxf, Arc8, 0.3, contour);
                            Vector2[] Line76 = { v69, v68 };
                            fun.drawBLine(dxf, Line76, 0.3, contour);
                            Vector2[] Line77 = { v68, v67 };
                            fun.drawBLine(dxf, Line77, 0.3, contour);
                            Vector2[] Line78 = { v67, v61 };
                            fun.drawBLine(dxf, Line78, 0.3, contour);
                            Vector2[] Line79 = { v63, v69 };
                            fun.drawBLine(dxf, Line79, 0.3, contour);
                            Vector2[] Line80 = { v64, v70 };
                            fun.drawBLine(dxf, Line80, 0.3, contour);
                            Vector2[] Line81 = { v62, v68 };
                            fun.drawBLine(dxf, Line81, 0.3, contour);

                            //坐标
                            Vector2 v73 = new Vector2(v52.X, v52.Y - 1 * scale);//螺纹内部
                            Vector2 v74 = new Vector2(a + lb - ll2 - xj2 / 2, v73.Y);
                            Vector2 v75 = new Vector2(a + lb - ll2 - 2.5 * scale, v74.Y);
                            Vector2 v76 = new Vector2(a + lb - ll2 + 2.5 * scale, v75.Y);
                            Vector2 v77 = new Vector2(a + lb - ll2 + xj2 / 2, v76.Y);
                            Vector2 v78 = new Vector2(v55.X, v77.Y);
                            Vector2 v79 = new Vector2(v74.X, v62.Y);
                            Vector2 v80 = new Vector2(v77.X, v62.Y);
                            Vector2 v97 = new Vector2((v79.X + v80.X) / 2, v79.Y + xj2 / 2 / Math.Tan(118 * pi / 180 / 2));
                            double llll = xj2;
                            double hhhh = xj2 / 2 / Math.Tan(118 * pi / 180 / 2);
                            double xx = (v55.X + v52.X) / 2;//圆的x轴坐标
                            double yy = ((v77.X - xx) * (v77.X - xx) - (v55.X - xx) * (v55.X - xx) - v55.Y * v55.Y + v77.Y * v77.Y) / (2 * (v77.Y - v55.Y));//圆的y轴坐标
                            double rr = Math.Sqrt((v77.X - xx) * (v77.X - xx) + (v77.Y - yy) * (v77.Y - yy));//圆的半径
                            double lllll = Math.Sqrt((v55.X - v77.X) * (v55.X - v77.X) + (v55.Y - v77.Y) * (v55.Y - v77.Y));
                            double hhhhh = rr - (Math.Sqrt((rr * rr) - lllll * lllll / 4));
                            //线段
                            Vector2[] Line82 = { v73, v78 };
                            fun.drawBLine(dxf, Line82, 0.3, contour);
                            Vector2[] Line83 = { v74, v79 };
                            fun.drawBLine(dxf, Line83, 0.3, contour);
                            Vector2[] Line86 = { v80, v77 };
                            fun.drawBLine(dxf, Line86, 0.3, contour);
                            Vector2[] Line87 = { v52, v73 };
                            fun.drawBLine(dxf, Line87, 0.3, contour);
                            Vector2[] Line88 = { v55, v78 };
                            fun.drawBLine(dxf, Line88, 0.3, contour);
                            Vector2[] Line68 = { v62, v80 };
                            fun.drawBLine(dxf, Line68, 0.3, contour);
                            Vector2[] Line89 = { v63, v79 };
                            fun.drawBLine(dxf, Line89, 0.3, contour);
                            LwPolyline Arc9 = new LwPolyline();
                            Arc9.Vertexes.Add(new LwPolylineVertex(v79));
                            Arc9.Vertexes.Add(new LwPolylineVertex(v80));
                            Arc9.Vertexes[0].Bulge = 2 * hhhh / llll;
                            fun.PolyFill(dxf, Arc9, 0.3, contour);
                            LwPolyline Arc10 = new LwPolyline();
                            Arc10.Vertexes.Add(new LwPolylineVertex(v52));
                            Arc10.Vertexes.Add(new LwPolylineVertex(v74));
                            Arc10.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                            fun.PolyFill(dxf, Arc10, 0.3, contour);
                            LwPolyline Arc11 = new LwPolyline();
                            Arc11.Vertexes.Add(new LwPolylineVertex(v77));
                            Arc11.Vertexes.Add(new LwPolylineVertex(v55));
                            Arc11.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                            fun.PolyFill(dxf, Arc11, 0.3, contour);
                            //第一区域填充
                            LwPolyline hatchpoly1 = new LwPolyline();
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v73));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v74));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v79));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v63));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v64));
                            hatchpoly1.Vertexes[5].Bulge = 1;
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v65));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v66));
                            hatchpoly1.IsClosed = true;
                            String[] htype1 = new String[100];
                            Line[] hline1 = new Line[100];
                            Arc[] arc1 = new Arc[100];
                            int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                            for (int i = 0; i < hnumst1; i++)
                            {
                                htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                                if (htype1[i] == "Line")
                                {
                                    hline1[i] = (Line)hatchpoly1.Explode()[i];
                                }
                                if (htype1[i] == "Arc")
                                {
                                    arc1[i] = (Arc)hatchpoly1.Explode()[i];
                                }
                            }
                            fun.hatchsub1(dxf, htype1, hnumst1, 45, 10 * scale, hline1, arc1, hatching);

                            //第二区域填充
                            LwPolyline hatchpoly2 = new LwPolyline();
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v72));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v71));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v70));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v69));
                            hatchpoly2.Vertexes[2].Bulge = 1;
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v68));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v67));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v60));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v59));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v58));
                            hatchpoly2.IsClosed = true;
                            String[] htype2 = new String[100];
                            Line[] hline2 = new Line[100];
                            Arc[] arc2 = new Arc[100];
                            int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
                            for (int i = 0; i < hnumst2; i++)
                            {
                                htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                                if (htype2[i] == "Line")
                                {
                                    hline2[i] = (Line)hatchpoly2.Explode()[i];
                                }
                                if (htype2[i] == "Arc")
                                {
                                    arc2[i] = (Arc)hatchpoly2.Explode()[i];
                                }
                            }
                            fun.hatchsub1(dxf, htype2, hnumst2, 45, 10 * scale, hline2, arc2, hatching);
                            //第三区域填充
                            LwPolyline hatchpoly3 = new LwPolyline();
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v77));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v78));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v55));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v56));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v57));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v61));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v62));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                            hatchpoly3.IsClosed = true;
                            String[] htype3 = new String[100];
                            Line[] hline3 = new Line[100];
                            int hnumst3 = hatchpoly3.Explode().Count;  //记录爆炸后，线段有多少
                            for (int i = 0; i < hnumst3; i++)
                            {
                                htype3[i] = hatchpoly3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                                if (htype3[i] == "Line")
                                {
                                    hline3[i] = (Line)hatchpoly3.Explode()[i];
                                }
                            }
                            fun.hatchsubofline(dxf, htype3, hnumst3, 45, 10 * scale, hline3, hatching);
                            //文本样式
                            DimensionStyle dimensionStyle = fun.CreateDimStyle();
                            dimensionStyle.ArrowSize = 0.2;
                            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
                            dimensionStyle.TextHeight = 1.0;
                            double offset = 10;
                            //标注
                            LinearDimension dim1 = new LinearDimension(new Line(new Vector2(-l3, -d / 2), v60), 4 * offset + (-d / 2 - v60.Y), 180, dimensionStyle);
                            dim1.UserText = "OAL="+ Math.Round((l3 + a + lb) / scale, 2);
                            dxf.AddEntity(dim1);

                            LinearDimension dim2 = new LinearDimension(new Line(new Vector2(a, -db / 2), v60), 3 * offset + (-db / 2 - v60.Y), 180, dimensionStyle);
                            dim2.UserText = "LB="+ Math.Round(lb / scale, 2);
                            dxf.AddEntity(dim2);

                            LinearDimension dim3 = new LinearDimension(new Line(v81, v60), 2 * offset + (v81.Y + v60.Y) - v58.Y, 180, dimensionStyle);
                            dim3.UserText = "LSC="+ Math.Round(lsc / scale, 2);
                            dxf.AddEntity(dim3);

                            LinearDimension dim4 = new LinearDimension(new Line(new Vector2(0, D / 2), v57), 4 * offset + v57.Y - D / 2, 0, dimensionStyle);
                            dim4.UserText = "LPR="+ Math.Round((a + lb) / scale, 2);
                            dxf.AddEntity(dim4);

                            LinearDimension dim5 = new LinearDimension(new Line(new Vector2(0, D / 2), v97), 4 * offset + v97.Y - D / 2, 0, dimensionStyle);
                            dim5.UserText = "LF="+ Math.Round(lf / scale, 2);
                            dxf.AddEntity(dim5);

                            Angular2LineDimension dim7 = new Angular2LineDimension(new Line(v56, v98), new Line(v56, v57), offset, dimensionStyle);
                            dim7.UserText = String.Format("BHTA={0}°", bhta / (pi / 180));
                            dxf.AddEntity(dim7);

                            LinearDimension dim10 = new LinearDimension(new Line(v56, v59), 3 * offset + v57.X - v56.X, 270, dimensionStyle);
                            dim10.UserText = "BD="+ Math.Round(bd / scale, 2);
                            dxf.AddEntity(dim10);

                            LinearDimension dim11 = new LinearDimension(new Line(v57, v60), 2 * offset, 270, dimensionStyle);
                            dim11.UserText = "BTED="+ Math.Round(bted / scale, 2);
                            dxf.AddEntity(dim11);

                            LinearDimension dim12 = new LinearDimension(new Line(v62, v68), offset + v61.X - v62.X, 270, dimensionStyle);
                            dim12.UserText = "DCONWS="+ Math.Round(dconws / scale, 2);
                            dxf.AddEntity(dim12);

                            LinearDimension dim13 = new LinearDimension(new Line(v74, v77), offset, 0, dimensionStyle);
                            dim13.UserText = "DD3="+ Math.Round(dd3 / scale, 2);
                            dxf.AddEntity(dim13);
                            //图框
                            if (isframe == 1)
                            {
                                Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-l3 + oal / 2 - 210, D / 2 + 148.5 - D / 2));
                                fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                            }
                        }
                    }
                    else
                    {
                        //坐标侧视图
                        Vector2 v1 = new Vector2(-l3 + b / 2 + 2 - (Math.Sqrt((b / 2 + 2) * (b / 2 + 2) - b * b / 4)), b / 2);//有扁尾机床侧
                        Vector2 v2 = new Vector2(-l3 + e - R, b / 2);
                        Vector2 v3 = new Vector2(-l3 + e, (D - tg * l3) / 2);
                        Vector2 v4 = new Vector2(0, D / 2);
                        Vector2 v5 = new Vector2(a, db / 2);
                        Vector2 v6 = new Vector2(v5.X, -v5.Y);
                        Vector2 v7 = new Vector2(v4.X, -v4.Y);
                        Vector2 v8 = new Vector2(v3.X, -v3.Y);
                        Vector2 v9 = new Vector2(v2.X, -v2.Y);
                        Vector2 v10 = new Vector2(v1.X, -v1.Y);
                        Vector2 v11 = new Vector2(-l3, 0);
                        double l = b;
                        double h = b / 2 + 2 - (Math.Sqrt((b / 2 + 2) * (b / 2 + 2) - l * l / 4));
                        double l11 = Math.Sqrt((v3.X - v2.X) * (v3.X - v2.X) + (v3.Y - v2.Y) * (v3.Y - v2.Y));
                        double h11 = R - Math.Sqrt((R * R) - l11 * l11 / 4);
                        //线段
                        LwPolyline Arc1 = new LwPolyline();
                        Arc1.Vertexes.Add(new LwPolylineVertex(v1));
                        Arc1.Vertexes.Add(new LwPolylineVertex(v10));
                        Arc1.Vertexes[0].Bulge = 2 * h / l;
                        fun.PolyFill(dxf, Arc1, 0.3, contour);
                        LwPolyline Arc2 = new LwPolyline();
                        Arc2.Vertexes.Add(new LwPolylineVertex(v2));
                        Arc2.Vertexes.Add(new LwPolylineVertex(v3));
                        Arc2.Vertexes[0].Bulge = 2 * h11 / l11;
                        fun.PolyFill(dxf, Arc2, 0.3, contour);
                        LwPolyline Arc3 = new LwPolyline();
                        Arc3.Vertexes.Add(new LwPolylineVertex(v8));
                        Arc3.Vertexes.Add(new LwPolylineVertex(v9));
                        Arc3.Vertexes[0].Bulge = 2 * h11 / l11;
                        fun.PolyFill(dxf, Arc3, 0.3, contour);
                        Vector2[] Line1 = { v1, v2 };
                        fun.drawBLine(dxf, Line1, 0.3, contour);
                        Vector2[] Line2 = { v3, v4 };
                        fun.drawBLine(dxf, Line2, 0.3, contour);
                        Vector2[] Line3 = { v4, v5 };
                        fun.drawBLine(dxf, Line3, 0.3, contour);
                        Vector2[] Line4 = { v5, v6 };
                        fun.drawBLine(dxf, Line4, 0.3, contour);
                        Vector2[] Line5 = { v6, v7 };
                        fun.drawBLine(dxf, Line5, 0.3, contour);
                        Vector2[] Line6 = { v7, v8 };
                        fun.drawBLine(dxf, Line6, 0.3, contour);
                        Vector2[] Line7 = { v9, v10 };
                        fun.drawBLine(dxf, Line7, 0.3, contour);
                        Vector2[] Line8 = { v4, v7 };
                        fun.drawBLine(dxf, Line8, 0.3, contour);
                        Vector2[] Line9 = { v3, v8 };
                        fun.drawBLine(dxf, Line9, 0.3, contour);
                        Vector2[] Line10 = { v2, v9 };
                        fun.drawBLine(dxf, Line10, 0.3, contour);
                        //工件侧
                        if (ccms3 == "ZYL10")
                        {
                            //坐标
                            Vector2 v51 = new Vector2(a, bd / 2);//工件侧外侧
                            Vector2 v52 = new Vector2(a + lb - ll2 - ct / 2, v51.Y);
                            Vector2 v55 = new Vector2(a + lb - ll2 + ct / 2, v52.Y);
                            Vector2 v56 = new Vector2(a + lb - (bd - bted) / 2 / Math.Tan(bhta), v52.Y);
                            Vector2 v57 = new Vector2(a + lb, bted / 2);
                            Vector2 v58 = new Vector2(v51.X, -v51.Y);
                            Vector2 v59 = new Vector2(v56.X, -v56.Y);
                            Vector2 v60 = new Vector2(v57.X, -v57.Y);
                            Vector2 v98 = new Vector2(v57.X, v56.Y);
                            //线段
                            Vector2[] Line58 = { v51, v52 };
                            fun.drawBLine(dxf, Line58, 0.3, contour);
                            Vector2[] Line60 = { v55, v56 };
                            fun.drawBLine(dxf, Line60, 0.3, contour);
                            Vector2[] Line61 = { v56, v57 };
                            fun.drawBLine(dxf, Line61, 0.3, contour);
                            Vector2[] Line62 = { v57, v60 };
                            fun.drawBLine(dxf, Line62, 0.3, contour);
                            Vector2[] Line63 = { v60, v59 };
                            fun.drawBLine(dxf, Line63, 0.3, contour);
                            Vector2[] Line64 = { v59, v58 };
                            fun.drawBLine(dxf, Line64, 0.3, contour);
                            Vector2[] Line65 = { v58, v51 };
                            fun.drawBLine(dxf, Line65, 0.3, contour);
                            Line Line93 = new Line(v56, v98);
                            Line93.Layer = dimensioning;
                            dxf.AddEntity(Line93);

                            //坐标
                            Vector2 v61 = new Vector2(v57.X, dconws / 2 + 1);//工件侧内侧
                            Vector2 v62 = new Vector2(v61.X - 1, dconws / 2);
                            Vector2 v63 = new Vector2(v57.X - ll1, v62.Y);
                            Vector2 v64 = new Vector2(v57.X - ll4, v63.Y);
                            Vector2 v65 = new Vector2(v64.X, dconws / 4);
                            Vector2 v66 = new Vector2(v51.X, v65.Y);
                            Vector2 v67 = new Vector2(v61.X, -v61.Y);
                            Vector2 v68 = new Vector2(v62.X, -v62.Y);
                            Vector2 v69 = new Vector2(v63.X, -v63.Y);
                            Vector2 v70 = new Vector2(v64.X, -v64.Y);
                            Vector2 v71 = new Vector2(v65.X, -v65.Y);
                            Vector2 v72 = new Vector2(v66.X, -v66.Y);
                            Vector2 v81 = new Vector2((v69.X + v70.X) / 2, v70.Y);
                            double lll = v63.X - v64.X;
                            double hhh = (v63.X - v64.X) / 2;
                            // 线段
                            Vector2[] Line67 = { v61, v62 };
                            fun.drawBLine(dxf, Line67, 0.3, contour);
                            LwPolyline Arc7 = new LwPolyline();
                            Arc7.Vertexes.Add(new LwPolylineVertex(v63));
                            Arc7.Vertexes.Add(new LwPolylineVertex(v64));
                            Arc7.Vertexes[0].Bulge = 2 * hhh / lll;
                            fun.PolyFill(dxf, Arc7, 0.3, contour);
                            Vector2[] Line70 = { v64, v65 };
                            fun.drawBLine(dxf, Line70, 0.3, contour);
                            Vector2[] Line71 = { v65, v66 };
                            fun.drawBLine(dxf, Line71, 0.3, contour);
                            Vector2[] Line72 = { v66, v72 };
                            fun.drawBLine(dxf, Line72, 0.3, contour);
                            Vector2[] Line73 = { v72, v71 };
                            fun.drawBLine(dxf, Line73, 0.3, contour);
                            Vector2[] Line74 = { v71, v70 };
                            fun.drawBLine(dxf, Line74, 0.3, contour);
                            LwPolyline Arc8 = new LwPolyline();
                            Arc8.Vertexes.Add(new LwPolylineVertex(v70));
                            Arc8.Vertexes.Add(new LwPolylineVertex(v69));
                            Arc8.Vertexes[0].Bulge = 2 * hhh / lll;
                            fun.PolyFill(dxf, Arc8, 0.3, contour);
                            Vector2[] Line76 = { v69, v68 };
                            fun.drawBLine(dxf, Line76, 0.3, contour);
                            Vector2[] Line77 = { v68, v67 };
                            fun.drawBLine(dxf, Line77, 0.3, contour);
                            Vector2[] Line78 = { v67, v61 };
                            fun.drawBLine(dxf, Line78, 0.3, contour);
                            Vector2[] Line79 = { v63, v69 };
                            fun.drawBLine(dxf, Line79, 0.3, contour);
                            Vector2[] Line80 = { v64, v70 };
                            fun.drawBLine(dxf, Line80, 0.3, contour);
                            Vector2[] Line81 = { v62, v68 };
                            fun.drawBLine(dxf, Line81, 0.3, contour);

                            //坐标
                            Vector2 v73 = new Vector2(v52.X, v52.Y - 1 * scale);//螺纹内部
                            Vector2 v74 = new Vector2(a + lb - ll2 - xj2 / 2, v73.Y);
                            Vector2 v75 = new Vector2(a + lb - ll2 - 2.5 * scale, v74.Y);
                            Vector2 v76 = new Vector2(a + lb - ll2 + 2.5 * scale, v75.Y);
                            Vector2 v77 = new Vector2(a + lb - ll2 + xj2 / 2, v76.Y);
                            Vector2 v78 = new Vector2(v55.X, v77.Y);
                            Vector2 v79 = new Vector2(v74.X, v62.Y);
                            Vector2 v80 = new Vector2(v77.X, v62.Y);
                            Vector2 v97 = new Vector2((v79.X + v80.X) / 2, v79.Y + xj2 / 2 / Math.Tan(118 * pi / 180 / 2));
                            double llll = xj2;
                            double hhhh = xj2 / 2 / Math.Tan(118 * pi / 180 / 2);
                            double xx = (v55.X + v52.X) / 2;//圆的x轴坐标
                            double yy = ((v77.X - xx) * (v77.X - xx) - (v55.X - xx) * (v55.X - xx) - v55.Y * v55.Y + v77.Y * v77.Y) / (2 * (v77.Y - v55.Y));//圆的y轴坐标
                            double rr = Math.Sqrt((v77.X - xx) * (v77.X - xx) + (v77.Y - yy) * (v77.Y - yy));//圆的半径
                            double lllll = Math.Sqrt((v55.X - v77.X) * (v55.X - v77.X) + (v55.Y - v77.Y) * (v55.Y - v77.Y));
                            double hhhhh = rr - (Math.Sqrt((rr * rr) - lllll * lllll / 4));
                            //线段
                            Vector2[] Line82 = { v73, v78 };
                            fun.drawBLine(dxf, Line82, 0.3, contour);
                            Vector2[] Line83 = { v74, v79 };
                            fun.drawBLine(dxf, Line83, 0.3, contour);
                            Vector2[] Line86 = { v80, v77 };
                            fun.drawBLine(dxf, Line86, 0.3, contour);
                            Vector2[] Line87 = { v52, v73 };
                            fun.drawBLine(dxf, Line87, 0.3, contour);
                            Vector2[] Line88 = { v55, v78 };
                            fun.drawBLine(dxf, Line88, 0.3, contour);
                            Vector2[] Line68 = { v62, v80 };
                            fun.drawBLine(dxf, Line68, 0.3, contour);
                            Vector2[] Line89 = { v63, v79 };
                            fun.drawBLine(dxf, Line89, 0.3, contour);
                            LwPolyline Arc9 = new LwPolyline();
                            Arc9.Vertexes.Add(new LwPolylineVertex(v79));
                            Arc9.Vertexes.Add(new LwPolylineVertex(v80));
                            Arc9.Vertexes[0].Bulge = 2 * hhhh / llll;
                            fun.PolyFill(dxf, Arc9, 0.3, contour);
                            LwPolyline Arc10 = new LwPolyline();
                            Arc10.Vertexes.Add(new LwPolylineVertex(v52));
                            Arc10.Vertexes.Add(new LwPolylineVertex(v74));
                            Arc10.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                            fun.PolyFill(dxf, Arc10, 0.3, contour);
                            LwPolyline Arc11 = new LwPolyline();
                            Arc11.Vertexes.Add(new LwPolylineVertex(v77));
                            Arc11.Vertexes.Add(new LwPolylineVertex(v55));
                            Arc11.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                            fun.PolyFill(dxf, Arc11, 0.3, contour);
                            //第一区域填充
                            LwPolyline hatchpoly1 = new LwPolyline();
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v73));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v74));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v79));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v63));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v64));
                            hatchpoly1.Vertexes[5].Bulge = 1;
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v65));
                            hatchpoly1.Vertexes.Add(new LwPolylineVertex(v66));
                            hatchpoly1.IsClosed = true;
                            String[] htype1 = new String[100];
                            Line[] hline1 = new Line[100];
                            Arc[] arc1 = new Arc[100];
                            int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                            for (int i = 0; i < hnumst1; i++)
                            {
                                htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                                if (htype1[i] == "Line")
                                {
                                    hline1[i] = (Line)hatchpoly1.Explode()[i];
                                }
                                if (htype1[i] == "Arc")
                                {
                                    arc1[i] = (Arc)hatchpoly1.Explode()[i];
                                }
                            }
                            fun.hatchsub1(dxf, htype1, hnumst1, 45, 10 * scale, hline1, arc1, hatching);

                            //第二区域填充
                            LwPolyline hatchpoly2 = new LwPolyline();
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v72));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v71));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v70));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v69));
                            hatchpoly2.Vertexes[2].Bulge = 1;
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v68));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v67));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v60));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v59));
                            hatchpoly2.Vertexes.Add(new LwPolylineVertex(v58));
                            hatchpoly2.IsClosed = true;
                            String[] htype2 = new String[100];
                            Line[] hline2 = new Line[100];
                            Arc[] arc2 = new Arc[100];
                            int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
                            for (int i = 0; i < hnumst2; i++)
                            {
                                htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                                if (htype2[i] == "Line")
                                {
                                    hline2[i] = (Line)hatchpoly2.Explode()[i];
                                }
                                if (htype2[i] == "Arc")
                                {
                                    arc2[i] = (Arc)hatchpoly2.Explode()[i];
                                }
                            }
                            fun.hatchsub1(dxf, htype2, hnumst2, 45, 10 * scale, hline2, arc2, hatching);
                            //第三区域填充
                            LwPolyline hatchpoly3 = new LwPolyline();
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v77));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v78));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v55));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v56));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v57));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v61));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v62));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                            hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                            hatchpoly3.IsClosed = true;
                            String[] htype3 = new String[100];
                            Line[] hline3 = new Line[100];
                            int hnumst3 = hatchpoly3.Explode().Count;  //记录爆炸后，线段有多少
                            for (int i = 0; i < hnumst3; i++)
                            {
                                htype3[i] = hatchpoly3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                                if (htype3[i] == "Line")
                                {
                                    hline3[i] = (Line)hatchpoly3.Explode()[i];
                                }
                            }
                            fun.hatchsubofline(dxf, htype3, hnumst3, 45, 5, hline3, hatching);
                            //文本样式
                            DimensionStyle dimensionStyle = fun.CreateDimStyle();
                            dimensionStyle.ArrowSize = 0.2;
                            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
                            dimensionStyle.TextHeight = 1.0;
                            double offset = 10;
                            //标注
                            LinearDimension dim1 = new LinearDimension(new Line(new Vector2(-l3, 0), v60), 3 * offset + v60.Y / 2 - (-db / 2), 180, dimensionStyle);
                            dim1.UserText = "OAL="+ Math.Round((l3 + a + lb) / scale, 2);
                            dxf.AddEntity(dim1);

                            LinearDimension dim2 = new LinearDimension(new Line(new Vector2(a, -db / 2), v60), offset + (v60.Y - (-db / 2)), 180, dimensionStyle);
                            dim2.UserText = "LB="+ Math.Round(lb / scale, 2);
                            dxf.AddEntity(dim2);

                            LinearDimension dim3 = new LinearDimension(new Line(v81, v60), offset + (v81.Y + v60.Y) / 2 - v58.Y, 180, dimensionStyle);
                            dim3.UserText = "LSC="+ Math.Round(lsc / scale, 2);
                            dxf.AddEntity(dim3);

                            LinearDimension dim4 = new LinearDimension(new Line(new Vector2(0, D / 2), v57), 2 * offset + D / 2 - v57.Y, 0, dimensionStyle);
                            dim4.UserText = "LPR="+ Math.Round((a + lb) / scale, 2);
                            dxf.AddEntity(dim4);

                            LinearDimension dim5 = new LinearDimension(new Line(new Vector2(0, D / 2), v97), offset + D / 2 - v97.Y, 0, dimensionStyle);
                            dim5.UserText = "LF="+ Math.Round(lf / scale, 2);
                            dxf.AddEntity(dim5);

                            Angular2LineDimension dim7 = new Angular2LineDimension(new Line(v56, v98), new Line(v56, v57), offset / 2, dimensionStyle);
                            dim7.UserText = String.Format("BHTA={0}°", bhta / (pi / 180));
                            dxf.AddEntity(dim7);

                            LinearDimension dim10 = new LinearDimension(new Line(v56, v59), 3 * offset + v57.X - v56.X, 270, dimensionStyle);
                            dim10.UserText = "BD="+ Math.Round(bd / scale, 2);
                            dxf.AddEntity(dim10);

                            LinearDimension dim11 = new LinearDimension(new Line(v57, v60), 2 * offset, 270, dimensionStyle);
                            dim11.UserText = "BTED="+ Math.Round(bted / scale, 2);
                            dxf.AddEntity(dim11);

                            LinearDimension dim12 = new LinearDimension(new Line(v62, v68), offset + v61.X - v62.X, 270, dimensionStyle);
                            dim12.UserText = "DCONWS="+ Math.Round(dconws / scale, 2);
                            dxf.AddEntity(dim12);

                            LinearDimension dim13 = new LinearDimension(new Line(v74, v77), offset, 0, dimensionStyle);
                            dim13.UserText = "DD3="+ Math.Round(dd3 / scale, 2);
                            dxf.AddEntity(dim13);

                            RadialDimension dimrad1 = new RadialDimension(new Vector2(-l3 + e + offset, (D - tg * l3) / 2 + offset), new Vector2(-l3 + e, (D - tg * l3) / 2), offset, dimensionStyle);//DimensionStyle.Default);
                            dimrad1.UserText = "CCMS="+ ccms1 + ",CZC=" + czc;
                            dxf.AddEntity(dimrad1);
                            //图框
                            if (isframe == 1)
                            {
                                Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(lpr - oal / 2 - 305, 148.5));
                                fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                            }
                        }

                        //坐标俯视图
                        Vector2 v101 = new Vector2(-190 - l3, d3 / 2);//有扁尾机床侧
                        Vector2 v102 = new Vector2(-190 - l3 + r, d3 / 2);
                        Vector2 v103 = new Vector2(-190 - l3 + c, v102.Y);
                        Vector2 v104 = new Vector2(-190 - l3 + c + 2, (D - tg * (l3 - c - 2)) / 2);
                        Vector2 v105 = new Vector2(-190, D / 2);
                        Vector2 v106 = new Vector2(-190 + a, db / 2);
                        Vector2 v107 = new Vector2(v106.X, -v106.Y);
                        Vector2 v108 = new Vector2(v105.X, -v105.Y);
                        Vector2 v109 = new Vector2(v104.X, -v104.Y);
                        Vector2 v110 = new Vector2(v103.X, -v103.Y);
                        Vector2 v111 = new Vector2(v102.X, -v102.Y);
                        Vector2 v112 = new Vector2(v101.X, -v101.Y);
                        Vector2 v113 = new Vector2(v101.X, Math.Sqrt(d3 * d3 / 4 - b * b / 4));
                        Vector2 v114 = new Vector2(v103.X, v113.Y);
                        Vector2 v115 = new Vector2(v104.X, v114.Y + (v104.Y - v103.Y));
                        Vector2 v116 = new Vector2(v101.X + e, v115.Y - (e - c - 2));
                        Vector2 v117 = new Vector2(v116.X, -v116.Y);
                        Vector2 v118 = new Vector2(v115.X, -v115.Y);
                        Vector2 v119 = new Vector2(v114.X, -v114.Y);
                        Vector2 v120 = new Vector2(v113.X, -v113.Y);
                        double l101 = Math.Sqrt((e - c - 2) * (e - c - 2) + (e - c - 2) * (e - c - 2));
                        double h101 = (e - c - 2) - (Math.Sqrt((e - c - 2) * (e - c - 2) - l101 * l101 / 4));
                        //线段
                        Vector2[] Line121 = { v101, v102 };
                        fun.drawBLine(dxf, Line121, 0.3, contour);
                        Vector2[] Line122 = { v111, v112 };
                        fun.drawBLine(dxf, Line122, 0.3, contour);
                        Vector2[] Line101 = { v102, v103 };
                        fun.drawBLine(dxf, Line101, 0.3, contour);
                        Vector2[] Line102 = { v103, v104 };
                        fun.drawBLine(dxf, Line102, 0.3, contour);
                        Vector2[] Line103 = { v104, v105 };
                        fun.drawBLine(dxf, Line103, 0.3, contour);
                        Vector2[] Line104 = { v105, v106 };
                        fun.drawBLine(dxf, Line104, 0.3, contour);
                        Vector2[] Line105 = { v106, v107 };
                        fun.drawBLine(dxf, Line105, 0.3, contour);
                        Vector2[] Line106 = { v107, v108 };
                        fun.drawBLine(dxf, Line106, 0.3, contour);
                        Vector2[] Line107 = { v108, v109 };
                        fun.drawBLine(dxf, Line107, 0.3, contour);
                        Vector2[] Line108 = { v109, v110 };
                        fun.drawBLine(dxf, Line108, 0.3, contour);
                        Vector2[] Line109 = { v110, v111 };
                        fun.drawBLine(dxf, Line109, 0.3, contour);
                        Vector2[] Line111 = { v112, v101 };
                        fun.drawBLine(dxf, Line111, 0.3, contour);
                        Vector2[] Line112 = { v113, v114 };
                        fun.drawBLine(dxf, Line112, 0.3, contour);
                        Vector2[] Line113 = { v114, v115 };
                        fun.drawBLine(dxf, Line113, 0.3, contour);
                        Vector2[] Line114 = { v116, v117 };
                        fun.drawBLine(dxf, Line114, 0.3, contour);
                        Vector2[] Line115 = { v118, v119 };
                        fun.drawBLine(dxf, Line115, 0.3, contour);
                        Vector2[] Line116 = { v119, v120 };
                        fun.drawBLine(dxf, Line116, 0.3, contour);
                        LwPolyline Arc103 = new LwPolyline();
                        Arc103.Vertexes.Add(new LwPolylineVertex(v116));
                        Arc103.Vertexes.Add(new LwPolylineVertex(v115));
                        Arc103.Vertexes[0].Bulge = 2 * h101 / l101;
                        fun.PolyFill(dxf, Arc103, 0.3, contour);
                        LwPolyline Arc104 = new LwPolyline();
                        Arc104.Vertexes.Add(new LwPolylineVertex(v118));
                        Arc104.Vertexes.Add(new LwPolylineVertex(v117));
                        Arc104.Vertexes[0].Bulge = 2 * h101 / l101;
                        fun.PolyFill(dxf, Arc104, 0.3, contour);
                        //俯视工件侧
                        if (ccms3 == "ZYL10")
                        {
                            //坐标
                            Vector2 v151 = new Vector2(-190 + a, bd / 2);//工件侧外侧
                            Vector2 v152 = new Vector2(-190 + a + lb - ll2 - ct / 2, v151.Y);
                            Vector2 v155 = new Vector2(-190 + a + lb - ll2 + ct / 2, v152.Y);
                            Vector2 v156 = new Vector2(-190 + a + lb - (bd - bted) / 2 / Math.Tan(bhta), v152.Y);
                            Vector2 v157 = new Vector2(-190 + a + lb, bted / 2);
                            Vector2 v158 = new Vector2(v151.X, -v151.Y);
                            Vector2 v159 = new Vector2(v156.X, -v156.Y);
                            Vector2 v160 = new Vector2(v157.X, -v157.Y);
                            Vector2 v198 = new Vector2(v157.X, v156.Y);
                            //线段
                            Vector2[] Line158 = { v151, v152 };
                            fun.drawBLine(dxf, Line158, 0.3, contour);
                            Vector2[] Line160 = { v155, v156 };
                            fun.drawBLine(dxf, Line160, 0.3, contour);
                            Vector2[] Line161 = { v156, v157 };
                            fun.drawBLine(dxf, Line161, 0.3, contour);
                            Vector2[] Line162 = { v157, v160 };
                            fun.drawBLine(dxf, Line162, 0.3, contour);
                            Vector2[] Line163 = { v160, v159 };
                            fun.drawBLine(dxf, Line163, 0.3, contour);
                            Vector2[] Line164 = { v159, v158 };
                            fun.drawBLine(dxf, Line164, 0.3, contour);
                            Vector2[] Line165 = { v158, v151 };
                            fun.drawBLine(dxf, Line165, 0.3, contour);

                            //坐标
                            Vector2 v161 = new Vector2(v157.X, dconws / 2 + 1);//工件侧内侧
                            Vector2 v162 = new Vector2(v161.X - 1, dconws / 2);
                            Vector2 v163 = new Vector2(v157.X - ll1, v162.Y);
                            Vector2 v164 = new Vector2(v157.X - ll4, v163.Y);
                            Vector2 v165 = new Vector2(v164.X, dconws / 4);
                            Vector2 v166 = new Vector2(v151.X, v165.Y);
                            Vector2 v167 = new Vector2(v161.X, -v161.Y);
                            Vector2 v168 = new Vector2(v162.X, -v162.Y);
                            Vector2 v169 = new Vector2(v163.X, -v163.Y);
                            Vector2 v170 = new Vector2(v164.X, -v164.Y);
                            Vector2 v171 = new Vector2(v165.X, -v165.Y);
                            Vector2 v172 = new Vector2(v166.X, -v166.Y);
                            Vector2 v181 = new Vector2((v169.X + v170.X) / 2, v170.Y);
                            double lll = v163.X - v164.X;
                            double hhh = (v163.X - v164.X) / 2;
                            // 线段
                            Vector2[] Line167 = { v161, v162 };
                            fun.drawBLine(dxf, Line167, 0.3, contour);
                            LwPolyline Arc17 = new LwPolyline();
                            Arc17.Vertexes.Add(new LwPolylineVertex(v163));
                            Arc17.Vertexes.Add(new LwPolylineVertex(v164));
                            Arc17.Vertexes[0].Bulge = 2 * hhh / lll;
                            fun.PolyFill(dxf, Arc17, 0.3, contour);
                            Vector2[] Line170 = { v164, v165 };
                            fun.drawBLine(dxf, Line170, 0.3, contour);
                            Vector2[] Line171 = { v165, v166 };
                            fun.drawBLine(dxf, Line171, 0.3, contour);
                            Vector2[] Line172 = { v166, v172 };
                            fun.drawBLine(dxf, Line172, 0.3, contour);
                            Vector2[] Line173 = { v172, v171 };
                            fun.drawBLine(dxf, Line173, 0.3, contour);
                            Vector2[] Line174 = { v171, v170 };
                            fun.drawBLine(dxf, Line174, 0.3, contour);
                            LwPolyline Arc18 = new LwPolyline();
                            Arc18.Vertexes.Add(new LwPolylineVertex(v170));
                            Arc18.Vertexes.Add(new LwPolylineVertex(v169));
                            Arc18.Vertexes[0].Bulge = 2 * hhh / lll;
                            fun.PolyFill(dxf, Arc18, 0.3, contour);
                            Vector2[] Line176 = { v169, v168 };
                            fun.drawBLine(dxf, Line176, 0.3, contour);
                            Vector2[] Line177 = { v168, v167 };
                            fun.drawBLine(dxf, Line177, 0.3, contour);
                            Vector2[] Line178 = { v167, v161 };
                            fun.drawBLine(dxf, Line178, 0.3, contour);
                            Vector2[] Line179 = { v163, v169 };
                            fun.drawBLine(dxf, Line179, 0.3, contour);
                            Vector2[] Line180 = { v164, v170 };
                            fun.drawBLine(dxf, Line180, 0.3, contour);
                            Vector2[] Line181 = { v162, v168 };
                            fun.drawBLine(dxf, Line181, 0.3, contour);

                            //坐标
                            Vector2 v173 = new Vector2(v152.X, v152.Y - 1 * scale);//螺纹内部
                            Vector2 v174 = new Vector2(-190 + a + lb - ll2 - xj2 / 2, v173.Y);
                            Vector2 v175 = new Vector2(-190 + a + lb - ll2 - 2.5 * scale, v174.Y);
                            Vector2 v176 = new Vector2(-190 + a + lb - ll2 + 2.5 * scale, v175.Y);
                            Vector2 v177 = new Vector2(-190 + a + lb - ll2 + xj2 / 2, v176.Y);
                            Vector2 v178 = new Vector2(v155.X, v177.Y);
                            Vector2 v179 = new Vector2(v174.X, v162.Y);
                            Vector2 v180 = new Vector2(v177.X, v162.Y);
                            Vector2 v197 = new Vector2((v179.X + v180.X) / 2, v179.Y + xj2 / 2 / Math.Tan(118 * pi / 180 / 2));
                            double llll = xj2;
                            double hhhh = xj2 / 2 / Math.Tan(118 * pi / 180 / 2);
                            double xx = (v155.X + v152.X) / 2;//圆的x轴坐标
                            double yy = ((v177.X - xx) * (v177.X - xx) - (v155.X - xx) * (v155.X - xx) - v155.Y * v155.Y + v177.Y * v177.Y) / (2 * (v177.Y - v155.Y));//圆的y轴坐标
                            double rr = Math.Sqrt((v177.X - xx) * (v177.X - xx) + (v177.Y - yy) * (v177.Y - yy));//圆的半径
                            double lllll = Math.Sqrt((v155.X - v177.X) * (v155.X - v177.X) + (v155.Y - v177.Y) * (v155.Y - v177.Y));
                            double hhhhh = rr - (Math.Sqrt((rr * rr) - lllll * lllll / 4));
                            //线段
                            Vector2[] Line182 = { v173, v178 };
                            fun.drawBLine(dxf, Line182, 0.3, contour);
                            Vector2[] Line183 = { v174, v179 };
                            fun.drawBLine(dxf, Line183, 0.3, contour);
                            Vector2[] Line186 = { v180, v177 };
                            fun.drawBLine(dxf, Line186, 0.3, contour);
                            Vector2[] Line187 = { v152, v173 };
                            fun.drawBLine(dxf, Line187, 0.3, contour);
                            Vector2[] Line188 = { v155, v178 };
                            fun.drawBLine(dxf, Line188, 0.3, contour);
                            Vector2[] Line168 = { v162, v180 };
                            fun.drawBLine(dxf, Line168, 0.3, contour);
                            Vector2[] Line189 = { v163, v179 };
                            fun.drawBLine(dxf, Line189, 0.3, contour);
                            LwPolyline Arc19 = new LwPolyline();
                            Arc19.Vertexes.Add(new LwPolylineVertex(v179));
                            Arc19.Vertexes.Add(new LwPolylineVertex(v180));
                            Arc19.Vertexes[0].Bulge = 2 * hhhh / llll;
                            fun.PolyFill(dxf, Arc19, 0.3, contour);
                            LwPolyline Arc110 = new LwPolyline();
                            Arc110.Vertexes.Add(new LwPolylineVertex(v152));
                            Arc110.Vertexes.Add(new LwPolylineVertex(v174));
                            Arc110.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                            fun.PolyFill(dxf, Arc110, 0.3, contour);
                            LwPolyline Arc111 = new LwPolyline();
                            Arc111.Vertexes.Add(new LwPolylineVertex(v177));
                            Arc111.Vertexes.Add(new LwPolylineVertex(v155));
                            Arc111.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                            fun.PolyFill(dxf, Arc111, 0.3, contour);
                            //第一区域填充
                            LwPolyline hatchpoly11 = new LwPolyline();
                            hatchpoly11.Vertexes.Add(new LwPolylineVertex(v151));
                            hatchpoly11.Vertexes.Add(new LwPolylineVertex(v152));
                            hatchpoly11.Vertexes.Add(new LwPolylineVertex(v173));
                            hatchpoly11.Vertexes.Add(new LwPolylineVertex(v174));
                            hatchpoly11.Vertexes.Add(new LwPolylineVertex(v179));
                            hatchpoly11.Vertexes.Add(new LwPolylineVertex(v163));
                            hatchpoly11.Vertexes.Add(new LwPolylineVertex(v164));
                            hatchpoly11.Vertexes[5].Bulge = 1;
                            hatchpoly11.Vertexes.Add(new LwPolylineVertex(v165));
                            hatchpoly11.Vertexes.Add(new LwPolylineVertex(v166));
                            hatchpoly11.IsClosed = true;
                            String[] htype11 = new String[100];
                            Line[] hline11 = new Line[100];
                            Arc[] arc11 = new Arc[100];
                            int hnumst11 = hatchpoly11.Explode().Count;  //记录爆炸后，线段有多少
                            for (int i = 0; i < hnumst11; i++)
                            {
                                htype11[i] = hatchpoly11.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                                if (htype11[i] == "Line")
                                {
                                    hline11[i] = (Line)hatchpoly11.Explode()[i];
                                }
                                if (htype11[i] == "Arc")
                                {
                                    arc11[i] = (Arc)hatchpoly11.Explode()[i];
                                }
                            }
                            fun.hatchsub1(dxf, htype11, hnumst11, 45, 10 * scale, hline11, arc11, hatching);

                            //第二区域填充
                            LwPolyline hatchpoly12 = new LwPolyline();
                            hatchpoly12.Vertexes.Add(new LwPolylineVertex(v172));
                            hatchpoly12.Vertexes.Add(new LwPolylineVertex(v171));
                            hatchpoly12.Vertexes.Add(new LwPolylineVertex(v170));
                            hatchpoly12.Vertexes.Add(new LwPolylineVertex(v169));
                            hatchpoly12.Vertexes[2].Bulge = 1;
                            hatchpoly12.Vertexes.Add(new LwPolylineVertex(v168));
                            hatchpoly12.Vertexes.Add(new LwPolylineVertex(v167));
                            hatchpoly12.Vertexes.Add(new LwPolylineVertex(v160));
                            hatchpoly12.Vertexes.Add(new LwPolylineVertex(v159));
                            hatchpoly12.Vertexes.Add(new LwPolylineVertex(v158));
                            hatchpoly12.IsClosed = true;
                            String[] htype12 = new String[100];
                            Line[] hline12 = new Line[100];
                            Arc[] arc12 = new Arc[100];
                            int hnumst12 = hatchpoly12.Explode().Count;  //记录爆炸后，线段有多少
                            for (int i = 0; i < hnumst12; i++)
                            {
                                htype12[i] = hatchpoly12.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                                if (htype12[i] == "Line")
                                {
                                    hline12[i] = (Line)hatchpoly12.Explode()[i];
                                }
                                if (htype12[i] == "Arc")
                                {
                                    arc12[i] = (Arc)hatchpoly12.Explode()[i];
                                }
                            }
                            fun.hatchsub1(dxf, htype12, hnumst12, 45, 10 * scale, hline12, arc12, hatching);
                            //第三区域填充
                            LwPolyline hatchpoly13 = new LwPolyline();
                            hatchpoly13.Vertexes.Add(new LwPolylineVertex(v177));
                            hatchpoly13.Vertexes.Add(new LwPolylineVertex(v178));
                            hatchpoly13.Vertexes.Add(new LwPolylineVertex(v155));
                            hatchpoly13.Vertexes.Add(new LwPolylineVertex(v156));
                            hatchpoly13.Vertexes.Add(new LwPolylineVertex(v157));
                            hatchpoly13.Vertexes.Add(new LwPolylineVertex(v161));
                            hatchpoly13.Vertexes.Add(new LwPolylineVertex(v162));
                            hatchpoly13.Vertexes.Add(new LwPolylineVertex(v180));
                            hatchpoly13.Vertexes.Add(new LwPolylineVertex(v180));
                            hatchpoly13.IsClosed = true;
                            String[] htype13 = new String[100];
                            Line[] hline13 = new Line[100];
                            int hnumst13 = hatchpoly13.Explode().Count;  //记录爆炸后，线段有多少
                            for (int i = 0; i < hnumst13; i++)
                            {
                                htype13[i] = hatchpoly13.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                                if (htype13[i] == "Line")
                                {
                                    hline13[i] = (Line)hatchpoly13.Explode()[i];
                                }
                            }
                            fun.hatchsubofline(dxf, htype13, hnumst13, 45, 5, hline13, hatching);
                            //文本样式
                            DimensionStyle dimensionStyle = fun.CreateDimStyle();
                            dimensionStyle.ArrowSize = 0.2;
                            dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                            dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
                            dimensionStyle.TextHeight = 1.0;
                            double offset = 10;
                            //图框
                            if (isframe == 1)
                            {
                                Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(lpr - oal / 2 - 305, 148.5));
                                fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                            }
                        }

                    }
                }
                //文件格式
                dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
                dxf.Save(path);
            }
            if (ccms1 == "mkg10")
            {
                double soal = Convert.ToDouble(data["l3"]) + Convert.ToDouble(data["lpcon"]) + Convert.ToDouble(data["lb"]);//总长度
                double sdb = Convert.ToDouble(data["db"]);//锥柄大径
                double scale = Convert.ToDouble(data["scale"]);//比例
                double a = Convert.ToDouble(data["a"]) * scale;
                double lb = Convert.ToDouble(data["lb"]) * scale;//体长
                double lpcon = Convert.ToDouble(data["lpcon"]) * scale;//连接伸出长度
                if (lpcon == 0)
                {
                    lpcon = a;
                }
                double lpr = lpcon + lb;//伸出长度
                double l3 = Convert.ToDouble(data["l3"]) * scale;
                double oal = l3 + lpr;//总长度
                                      //工件侧
                double ll1 = Convert.ToDouble(data["ll1"]) * scale;
                double ll4 = Convert.ToDouble(data["ll4"]) * scale;
                double lsc = (ll1 + ll4) / 2;//夹紧长度
                double dconws = Convert.ToDouble(data["dconws"]) * scale;//工件侧连接直径
                double bted = Convert.ToDouble(data["bted"]) * scale;//体锥度端径
                double bd = Convert.ToDouble(data["bd"]) * scale;//体直径
                double bhta = Convert.ToDouble(data["bhta"]) * pi / 180;//体半锥角
                double ll2 = Convert.ToDouble(data["ll2"]) * scale;
                double lf = lpr - ll2;//功能长度
                double dd3 = Convert.ToDouble(data["dd3"]) * scale;
                double p2 = Convert.ToDouble(data["p2"]) * scale;//螺距
                double xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                double ct = Convert.ToDouble(data["ct"]) * scale;
                //meg
                double D = Convert.ToDouble(data["dd"]) * scale;
                double db = Convert.ToDouble(data["db"]) * scale;
                double d = Convert.ToDouble(data["d"]) * scale;
                double tg = Convert.ToDouble(data["tg"]) * scale;//锥度
                double czc = Convert.ToDouble(data["czc"]);
                if (scale == 0 && ccms1 == "mkg10" && czc < 80)
                {
                    if (soal < 68 && sdb < 31.2)
                    {
                        scale = 5.0;
                    }
                    else if (soal < 85 && sdb < 39)
                    {
                        scale = 4.0;
                    }
                    else if (soal < 113 && sdb < 52)
                    {
                        scale = 3.0;
                    }
                    else if (soal < 226 && sdb < 104)
                    {
                        scale = 1.5;
                    }
                    else if (soal < 340 && sdb < 156)
                    {
                        scale = 1.0;
                    }
                    else if (soal < 453 && sdb < 208)
                    {
                        scale = 0.75;
                    }
                    else
                    {
                        scale = 0.5;
                    }
                }//比例判断
                if (scale == 0 && ccms1 == "mkg10" && czc > 6)
                {
                    if (soal < 300)
                    {
                        scale = 0.5;
                    }
                    else if (soal < 375)
                    {
                        scale = 0.4;
                    }
                    else if (soal < 500)
                    {
                        scale = 0.3;
                    }
                    else if (soal < 600)
                    {
                        scale = 0.25;
                    }
                }//比例判断
                if (ccms1 == "mkg10")//英制
                {
                    if (czc == 0)
                    {
                        D = 9.045 * scale;
                        db = 9.2 * scale;
                        a = 3 * scale;
                        l3 = 56.5 * scale;
                        d = 6.4 * scale;
                        tg = 1 / 19.212 * scale;
                    }
                    if (czc == 1)
                    {
                        D = 12.065 * scale;
                        db = 12.2 * scale;
                        a = 3.5 * scale;
                        l3 = 62 * scale;
                        d = 9.4 * scale;
                        tg = 1 / 20.047 * scale;
                    }
                    if (czc == 2)
                    {
                        D = 17.78 * scale;
                        db = 18 * scale;
                        a = 5 * scale;
                        l3 = 75 * scale;
                        tg = 1 / 20.02 * scale;
                        d = 14.6 * scale;
                    }
                    if (czc == 3)
                    {
                        D = 23.825 * scale;
                        db = 24.1 * scale;
                        a = 5 * scale;
                        l3 = 94 * scale;
                        tg = 1 / 19.922 * scale;
                        d = 19.8 * scale;
                    }
                    if (czc == 4)
                    {
                        D = 31.267 * scale;
                        db = 31.6 * scale;
                        a = 6.5 * scale;
                        l3 = 117.5 * scale;
                        tg = 1 / 19.254 * scale;
                        d = 25.9 * scale;
                    }
                    if (czc == 5)
                    {

                        D = 44.399 * scale;
                        db = 44.7 * scale;
                        a = 6.5 * scale;
                        l3 = 149.5 * scale;
                        d = 37.6 * scale;
                        tg = 1 / 19.002 * scale;
                    }
                    if (czc == 6)
                    {
                        D = 63.348 * scale;
                        db = 63.8 * scale;
                        a = 8 * scale;
                        l3 = 210 * scale;
                        d = 53.9 * scale;
                        tg = 1 / 19.18 * scale;
                    }
                }
                string ccms3 = "ZYL10";//工件侧形状
                string ccms2 = Convert.ToString(data["ccms2"]);//工件侧大小
                if (ccms3 == "ZYL10" && ccms2 == "6")
                {
                    dconws = 6 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 25 * scale;
                    dd3 = 6 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 15 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "8")
                {
                    dconws = 8 * scale;
                    ll1 = 35 * scale;
                    ll2 = 18 * scale;
                    ll4 = 37 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 28 * scale;
                    dd3 = 8 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 20 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "10")
                {
                    dconws = 10 * scale;
                    ll1 = 39 * scale;
                    ll2 = 20 * scale;
                    ll4 = 41 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 35 * scale;
                    dd3 = 10 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 11 * scale;//沉头
                    bted = 25 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "12")
                {
                    dconws = 12 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 42 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 12 * scale;//沉头
                    bted = 30 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "14")
                {
                    dconws = 14 * scale;
                    ll1 = 44 * scale;
                    ll2 = 22.5 * scale;
                    ll4 = 46 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 44 * scale;
                    dd3 = 12 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 14 * scale;//沉头
                    bted = 32 * scale;
                    bhta = 25 * pi / 180;
                    lb = 50 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "16")
                {
                    dconws = 16 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 48 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 16 * scale;//沉头
                    bted = 36 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "18")
                {
                    dconws = 18 * scale;
                    ll1 = 47 * scale;
                    ll2 = 24 * scale;
                    ll4 = 49 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 50 * scale;
                    dd3 = 14 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 18 * scale;//沉头
                    bted = 38 * scale;
                    bhta = 25 * pi / 180;
                    lb = 60 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                if (ccms3 == "ZYL10" && ccms2 == "20")
                {
                    dconws = 20 * scale;
                    ll1 = 49 * scale;
                    ll2 = 25 * scale;
                    ll4 = 51 * scale;
                    lsc = (ll1 + ll4) / 2;
                    bd = 52 * scale;
                    dd3 = 16 * scale;
                    p2 = 1 * scale;//螺距
                    xj2 = dd3 - 1.0852 * p2;//螺纹小径2
                    ct = 20 * scale;//沉头
                    bted = 40 * scale;
                    bhta = 25 * pi / 180;
                    lb = 70 * scale;
                    lpr = lpcon + lb;
                    lf = (lpr - ll2);//功能长度
                    oal = l3 + lpr;//总长度
                }
                double isframe = Convert.ToDouble(data["isframe"]);
                //判断锥柄skg
                if (ccms1 == "mkg10")
                {
                    //坐标
                    Vector2 v101 = new Vector2(-l3, d / 2);//无扁尾机床侧
                    Vector2 v102 = new Vector2(0, D / 2);
                    Vector2 v103 = new Vector2(a, db / 2);
                    Vector2 v104 = new Vector2(v103.X, -v103.Y);
                    Vector2 v105 = new Vector2(v102.X, -v102.Y);
                    Vector2 v106 = new Vector2(v101.X, -v101.Y);
                    //线段
                    Vector2[] Line1 = { v101, v102 };
                    fun.drawBLine(dxf, Line1, 0.3, contour);
                    Vector2[] Line2 = { v102, v103 };
                    fun.drawBLine(dxf, Line2, 0.3, contour);
                    Vector2[] Line3 = { v103, v104 };
                    fun.drawBLine(dxf, Line3, 0.3, contour);
                    Vector2[] Line4 = { v104, v105 };
                    fun.drawBLine(dxf, Line4, 0.3, contour);
                    Vector2[] Line5 = { v105, v106 };
                    fun.drawBLine(dxf, Line5, 0.3, contour);
                    Vector2[] Line6 = { v106, v101 };
                    fun.drawBLine(dxf, Line6, 0.3, contour);
                    //工件侧
                    if (ccms3 == "ZYL10")
                    {
                        //坐标
                        Vector2 v51 = new Vector2(a, bd / 2);//工件侧外侧
                        Vector2 v52 = new Vector2(a + lb - ll2 - ct / 2, v51.Y);
                        Vector2 v55 = new Vector2(a + lb - ll2 + ct / 2, v52.Y);
                        Vector2 v56 = new Vector2(a + lb - (bd - bted) / 2 / Math.Tan(bhta), v52.Y);
                        Vector2 v57 = new Vector2(a + lb, bted / 2);
                        Vector2 v58 = new Vector2(v51.X, -v51.Y);
                        Vector2 v59 = new Vector2(v56.X, -v56.Y);
                        Vector2 v60 = new Vector2(v57.X, -v57.Y);
                        Vector2 v98 = new Vector2(v57.X, v56.Y);
                        //线段
                        Vector2[] Line58 = { v51, v52 };
                        fun.drawBLine(dxf, Line58, 0.3, contour);
                        Vector2[] Line60 = { v55, v56 };
                        fun.drawBLine(dxf, Line60, 0.3, contour);
                        Vector2[] Line61 = { v56, v57 };
                        fun.drawBLine(dxf, Line61, 0.3, contour);
                        Vector2[] Line62 = { v57, v60 };
                        fun.drawBLine(dxf, Line62, 0.3, contour);
                        Vector2[] Line63 = { v60, v59 };
                        fun.drawBLine(dxf, Line63, 0.3, contour);
                        Vector2[] Line64 = { v59, v58 };
                        fun.drawBLine(dxf, Line64, 0.3, contour);
                        Vector2[] Line65 = { v58, v51 };
                        fun.drawBLine(dxf, Line65, 0.3, contour);
                        Line Line93 = new Line(v56, v98);
                        Line93.Layer = dimensioning;
                        dxf.AddEntity(Line93);

                        //坐标
                        Vector2 v61 = new Vector2(v57.X, dconws / 2 + 1);//工件侧内侧
                        Vector2 v62 = new Vector2(v61.X - 1, dconws / 2);
                        Vector2 v63 = new Vector2(v57.X - ll1, v62.Y);
                        Vector2 v64 = new Vector2(v57.X - ll4, v63.Y);
                        Vector2 v65 = new Vector2(v64.X, dconws / 4);
                        Vector2 v66 = new Vector2(v51.X, v65.Y);
                        Vector2 v67 = new Vector2(v61.X, -v61.Y);
                        Vector2 v68 = new Vector2(v62.X, -v62.Y);
                        Vector2 v69 = new Vector2(v63.X, -v63.Y);
                        Vector2 v70 = new Vector2(v64.X, -v64.Y);
                        Vector2 v71 = new Vector2(v65.X, -v65.Y);
                        Vector2 v72 = new Vector2(v66.X, -v66.Y);
                        Vector2 v81 = new Vector2((v69.X + v70.X) / 2, v70.Y);
                        double lll = v63.X - v64.X;
                        double hhh = (v63.X - v64.X) / 2;
                        // 线段
                        Vector2[] Line67 = { v61, v62 };
                        fun.drawBLine(dxf, Line67, 0.3, contour);
                        LwPolyline Arc7 = new LwPolyline();
                        Arc7.Vertexes.Add(new LwPolylineVertex(v63));
                        Arc7.Vertexes.Add(new LwPolylineVertex(v64));
                        Arc7.Vertexes[0].Bulge = 2 * hhh / lll;
                        fun.PolyFill(dxf, Arc7, 0.3, contour);
                        Vector2[] Line70 = { v64, v65 };
                        fun.drawBLine(dxf, Line70, 0.3, contour);
                        Vector2[] Line71 = { v65, v66 };
                        fun.drawBLine(dxf, Line71, 0.3, contour);
                        Vector2[] Line72 = { v66, v72 };
                        fun.drawBLine(dxf, Line72, 0.3, contour);
                        Vector2[] Line73 = { v72, v71 };
                        fun.drawBLine(dxf, Line73, 0.3, contour);
                        Vector2[] Line74 = { v71, v70 };
                        fun.drawBLine(dxf, Line74, 0.3, contour);
                        LwPolyline Arc8 = new LwPolyline();
                        Arc8.Vertexes.Add(new LwPolylineVertex(v70));
                        Arc8.Vertexes.Add(new LwPolylineVertex(v69));
                        Arc8.Vertexes[0].Bulge = 2 * hhh / lll;
                        fun.PolyFill(dxf, Arc8, 0.3, contour);
                        Vector2[] Line76 = { v69, v68 };
                        fun.drawBLine(dxf, Line76, 0.3, contour);
                        Vector2[] Line77 = { v68, v67 };
                        fun.drawBLine(dxf, Line77, 0.3, contour);
                        Vector2[] Line78 = { v67, v61 };
                        fun.drawBLine(dxf, Line78, 0.3, contour);
                        Vector2[] Line79 = { v63, v69 };
                        fun.drawBLine(dxf, Line79, 0.3, contour);
                        Vector2[] Line80 = { v64, v70 };
                        fun.drawBLine(dxf, Line80, 0.3, contour);
                        Vector2[] Line81 = { v62, v68 };
                        fun.drawBLine(dxf, Line81, 0.3, contour);

                        //坐标
                        Vector2 v73 = new Vector2(v52.X, v52.Y - 1 * scale);//螺纹内部
                        Vector2 v74 = new Vector2(a + lb - ll2 - xj2 / 2, v73.Y);
                        Vector2 v75 = new Vector2(a + lb - ll2 - 2.5 * scale, v74.Y);
                        Vector2 v76 = new Vector2(a + lb - ll2 + 2.5 * scale, v75.Y);
                        Vector2 v77 = new Vector2(a + lb - ll2 + xj2 / 2, v76.Y);
                        Vector2 v78 = new Vector2(v55.X, v77.Y);
                        Vector2 v79 = new Vector2(v74.X, v62.Y);
                        Vector2 v80 = new Vector2(v77.X, v62.Y);
                        Vector2 v97 = new Vector2((v79.X + v80.X) / 2, v79.Y + xj2 / 2 / Math.Tan(118 * pi / 180 / 2));
                        double llll = xj2;
                        double hhhh = xj2 / 2 / Math.Tan(118 * pi / 180 / 2);
                        double xx = (v55.X + v52.X) / 2;//圆的x轴坐标
                        double yy = ((v77.X - xx) * (v77.X - xx) - (v55.X - xx) * (v55.X - xx) - v55.Y * v55.Y + v77.Y * v77.Y) / (2 * (v77.Y - v55.Y));//圆的y轴坐标
                        double rr = Math.Sqrt((v77.X - xx) * (v77.X - xx) + (v77.Y - yy) * (v77.Y - yy));//圆的半径
                        double lllll = Math.Sqrt((v55.X - v77.X) * (v55.X - v77.X) + (v55.Y - v77.Y) * (v55.Y - v77.Y));
                        double hhhhh = rr - (Math.Sqrt((rr * rr) - lllll * lllll / 4));
                        //线段
                        Vector2[] Line82 = { v73, v78 };
                        fun.drawBLine(dxf, Line82, 0.3, contour);
                        Vector2[] Line83 = { v74, v79 };
                        fun.drawBLine(dxf, Line83, 0.3, contour);
                        Vector2[] Line86 = { v80, v77 };
                        fun.drawBLine(dxf, Line86, 0.3, contour);
                        Vector2[] Line87 = { v52, v73 };
                        fun.drawBLine(dxf, Line87, 0.3, contour);
                        Vector2[] Line88 = { v55, v78 };
                        fun.drawBLine(dxf, Line88, 0.3, contour);
                        Vector2[] Line68 = { v62, v80 };
                        fun.drawBLine(dxf, Line68, 0.3, contour);
                        Vector2[] Line89 = { v63, v79 };
                        fun.drawBLine(dxf, Line89, 0.3, contour);
                        LwPolyline Arc9 = new LwPolyline();
                        Arc9.Vertexes.Add(new LwPolylineVertex(v79));
                        Arc9.Vertexes.Add(new LwPolylineVertex(v80));
                        Arc9.Vertexes[0].Bulge = 2 * hhhh / llll;
                        fun.PolyFill(dxf, Arc9, 0.3, contour);
                        LwPolyline Arc10 = new LwPolyline();
                        Arc10.Vertexes.Add(new LwPolylineVertex(v52));
                        Arc10.Vertexes.Add(new LwPolylineVertex(v74));
                        Arc10.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                        fun.PolyFill(dxf, Arc10, 0.3, contour);
                        LwPolyline Arc11 = new LwPolyline();
                        Arc11.Vertexes.Add(new LwPolylineVertex(v77));
                        Arc11.Vertexes.Add(new LwPolylineVertex(v55));
                        Arc11.Vertexes[0].Bulge = 2 * hhhhh / lllll;
                        fun.PolyFill(dxf, Arc11, 0.3, contour);
                        //第一区域填充
                        LwPolyline hatchpoly1 = new LwPolyline();
                        hatchpoly1.Vertexes.Add(new LwPolylineVertex(v51));
                        hatchpoly1.Vertexes.Add(new LwPolylineVertex(v52));
                        hatchpoly1.Vertexes.Add(new LwPolylineVertex(v73));
                        hatchpoly1.Vertexes.Add(new LwPolylineVertex(v74));
                        hatchpoly1.Vertexes.Add(new LwPolylineVertex(v79));
                        hatchpoly1.Vertexes.Add(new LwPolylineVertex(v63));
                        hatchpoly1.Vertexes.Add(new LwPolylineVertex(v64));
                        hatchpoly1.Vertexes[5].Bulge = 1;
                        hatchpoly1.Vertexes.Add(new LwPolylineVertex(v65));
                        hatchpoly1.Vertexes.Add(new LwPolylineVertex(v66));
                        hatchpoly1.IsClosed = true;
                        String[] htype1 = new String[100];
                        Line[] hline1 = new Line[100];
                        Arc[] arc1 = new Arc[100];
                        int hnumst1 = hatchpoly1.Explode().Count;  //记录爆炸后，线段有多少
                        for (int i = 0; i < hnumst1; i++)
                        {
                            htype1[i] = hatchpoly1.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                            if (htype1[i] == "Line")
                            {
                                hline1[i] = (Line)hatchpoly1.Explode()[i];
                            }
                            if (htype1[i] == "Arc")
                            {
                                arc1[i] = (Arc)hatchpoly1.Explode()[i];
                            }
                        }
                        fun.hatchsub1(dxf, htype1, hnumst1, 45, 10 * scale, hline1, arc1, hatching);

                        //第二区域填充
                        LwPolyline hatchpoly2 = new LwPolyline();
                        hatchpoly2.Vertexes.Add(new LwPolylineVertex(v72));
                        hatchpoly2.Vertexes.Add(new LwPolylineVertex(v71));
                        hatchpoly2.Vertexes.Add(new LwPolylineVertex(v70));
                        hatchpoly2.Vertexes.Add(new LwPolylineVertex(v69));
                        hatchpoly2.Vertexes[2].Bulge = 1;
                        hatchpoly2.Vertexes.Add(new LwPolylineVertex(v68));
                        hatchpoly2.Vertexes.Add(new LwPolylineVertex(v67));
                        hatchpoly2.Vertexes.Add(new LwPolylineVertex(v60));
                        hatchpoly2.Vertexes.Add(new LwPolylineVertex(v59));
                        hatchpoly2.Vertexes.Add(new LwPolylineVertex(v58));
                        hatchpoly2.IsClosed = true;
                        String[] htype2 = new String[100];
                        Line[] hline2 = new Line[100];
                        Arc[] arc2 = new Arc[100];
                        int hnumst2 = hatchpoly2.Explode().Count;  //记录爆炸后，线段有多少
                        for (int i = 0; i < hnumst2; i++)
                        {
                            htype2[i] = hatchpoly2.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                            if (htype2[i] == "Line")
                            {
                                hline2[i] = (Line)hatchpoly2.Explode()[i];
                            }
                            if (htype2[i] == "Arc")
                            {
                                arc2[i] = (Arc)hatchpoly2.Explode()[i];
                            }
                        }
                        fun.hatchsub1(dxf, htype2, hnumst2, 45, 10 * scale, hline2, arc2, hatching);
                        //第三区域填充
                        LwPolyline hatchpoly3 = new LwPolyline();
                        hatchpoly3.Vertexes.Add(new LwPolylineVertex(v77));
                        hatchpoly3.Vertexes.Add(new LwPolylineVertex(v78));
                        hatchpoly3.Vertexes.Add(new LwPolylineVertex(v55));
                        hatchpoly3.Vertexes.Add(new LwPolylineVertex(v56));
                        hatchpoly3.Vertexes.Add(new LwPolylineVertex(v57));
                        hatchpoly3.Vertexes.Add(new LwPolylineVertex(v61));
                        hatchpoly3.Vertexes.Add(new LwPolylineVertex(v62));
                        hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                        hatchpoly3.Vertexes.Add(new LwPolylineVertex(v80));
                        hatchpoly3.IsClosed = true;
                        String[] htype3 = new String[100];
                        Line[] hline3 = new Line[100];
                        int hnumst3 = hatchpoly3.Explode().Count;  //记录爆炸后，线段有多少
                        for (int i = 0; i < hnumst3; i++)
                        {
                            htype3[i] = hatchpoly3.Explode()[i].Type.ToString();    //将所有的元素记录成一个数组
                            if (htype3[i] == "Line")
                            {
                                hline3[i] = (Line)hatchpoly3.Explode()[i];
                            }
                        }
                        fun.hatchsubofline(dxf, htype3, hnumst3, 45, 10 * scale, hline3, hatching);
                        //文本样式
                        DimensionStyle dimensionStyle = fun.CreateDimStyle();
                        dimensionStyle.ArrowSize = 0.2;
                        dimensionStyle.DimArrow1 = DimensionArrowhead.Closedfilled;
                        dimensionStyle.DimArrow2 = DimensionArrowhead.Closedfilled;
                        dimensionStyle.TextHeight = 1.0;
                        double offset = 10;
                        //标注
                        LinearDimension dim1 = new LinearDimension(new Line(new Vector2(-l3, -d / 2), v60), 4 * offset + (-d / 2 - v60.Y), 180, dimensionStyle);
                        dim1.UserText = "OAL="+ Math.Round((l3 + a + lb) / scale, 2);
                        dxf.AddEntity(dim1);

                        LinearDimension dim2 = new LinearDimension(new Line(new Vector2(a, -db / 2), v60), 3 * offset + (-db / 2 - v60.Y), 180, dimensionStyle);
                        dim2.UserText = "LB="+ Math.Round(lb / scale, 2);
                        dxf.AddEntity(dim2);

                        LinearDimension dim3 = new LinearDimension(new Line(v81, v60), 2 * offset + (v81.Y + v60.Y) - v58.Y, 180, dimensionStyle);
                        dim3.UserText = "LSC="+ Math.Round(lsc / scale, 2);
                        dxf.AddEntity(dim3);

                        LinearDimension dim4 = new LinearDimension(new Line(new Vector2(0, D / 2), v57), 4 * offset + v57.Y - D / 2, 0, dimensionStyle);
                        dim4.UserText = "LPR="+ Math.Round((a + lb) / scale, 2);
                        dxf.AddEntity(dim4);

                        LinearDimension dim5 = new LinearDimension(new Line(new Vector2(0, D / 2), v97), 4 * offset + v97.Y - D / 2, 0, dimensionStyle);
                        dim5.UserText = "LF="+ Math.Round(lf / scale, 2);
                        dxf.AddEntity(dim5);

                        Angular2LineDimension dim7 = new Angular2LineDimension(new Line(v56, v98), new Line(v56, v57), offset, dimensionStyle);
                        dim7.UserText = String.Format("BHTA={0}°", bhta / (pi / 180));
                        dxf.AddEntity(dim7);

                        LinearDimension dim10 = new LinearDimension(new Line(v56, v59), 3 * offset + v57.X - v56.X, 270, dimensionStyle);
                        dim10.UserText = "BD="+ Math.Round(bd / scale, 2);
                        dxf.AddEntity(dim10);

                        LinearDimension dim11 = new LinearDimension(new Line(v57, v60), 2 * offset, 270, dimensionStyle);
                        dim11.UserText = "BTED="+ Math.Round(bted / scale, 2);
                        dxf.AddEntity(dim11);

                        LinearDimension dim12 = new LinearDimension(new Line(v62, v68), offset + v61.X - v62.X, 270, dimensionStyle);
                        dim12.UserText = "DCONWS="+ Math.Round(dconws / scale, 2);
                        dxf.AddEntity(dim12);

                        LinearDimension dim13 = new LinearDimension(new Line(v74, v77), offset, 0, dimensionStyle);
                        dim13.UserText = "DD3="+ Math.Round(dd3 / scale, 2);
                        dxf.AddEntity(dim13);
                        //图框
                        if (isframe == 1)
                        {
                            Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-l3 + oal / 2 - 210, D / 2 + 148.5 - D / 2));
                            fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                        }
                    }
                }

                fun.SetLayer(dxf); fun.SetByLayer(dxf);

                //文件格式
                dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
                dxf.Save(path);
            }
        }
        public static void ConverterStationary(Dictionary<string, Object> data)    //转换器，固定B型
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);

            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double soal = Convert.ToDouble(data["oal"]);//总长度
            //double scale = 5;
            double scale = Convert.ToDouble(data["scale"]);//比例
            if (scale == 0)
            {
                if (soal < 29.6)
                {
                    scale = 5.0;
                }
                else if (soal < 37)
                {
                    scale = 4.0;
                }
                else if (soal < 49.3)
                {
                    scale = 3;
                }
                else if (soal < 74)
                {
                    scale = 2;
                }
                else if (soal < 148)
                {
                    scale = 1;
                }
                else
                {
                    scale = 0.75;
                }
            }//比例判断
            double radh = Convert.ToDouble(data["radh"]) * scale;//径向高度
            double oah = Convert.ToDouble(data["oah"]) * scale;//总高度
            double rhcau = Convert.ToDouble(data["rhcau"]) * pi / 180;//径向高度倒角角上
            double rhcdu = Convert.ToDouble(data["rhcdu"]) * scale;//径向高度倒角距离上部
            double rhcdl = Convert.ToDouble(data["rhcdl"]) * scale;//径向高度倒角距离底部
            double rhcal = Convert.ToDouble(data["rhcal"]) * pi / 180;//径向高度倒角角低
            double radwof = Convert.ToDouble(data["radwof"]) * scale;//径向偏移
            double radhof = Convert.ToDouble(data["radhof"]) * scale;//径向高度偏移
            double hf = Convert.ToDouble(data["hf"]) * scale;//功能高度
            double oaw = Convert.ToDouble(data["oaw"]) * scale;//总宽度
            double radw = Convert.ToDouble(data["radw"]) * scale;//径向宽度
            double dcon = Convert.ToDouble(data["dcon"]) * scale;//连接直径
            double ls = Convert.ToDouble(data["ls"]) * scale;//柄的长度
            double lpr = Convert.ToDouble(data["lpr"]) * scale;//伸出长度
            double oal = Convert.ToDouble(data["oal"]) * scale;//总长度
            double lf = Convert.ToDouble(data["lf"]) * scale;//功能长度
            double h2 = Convert.ToDouble(data["h2"]) * scale;
            double h7 = oah - radh;
            double h8 = Convert.ToDouble(data["h8"]) * scale;
            double h9 = Convert.ToDouble(data["h9"]) * scale;
            double a = Convert.ToDouble(data["a"]) * pi / 180;
            //string style = "b2";
            string style = Convert.ToString(data["style"]);
            double ll2 = Convert.ToDouble(data["ll2"]) * scale;//机床侧
            double ll3 = Convert.ToDouble(data["ll3"]) * scale;
            double ll7 = Convert.ToDouble(data["ll7"]) * scale;
            double hh2 = Convert.ToDouble(data["hh2"]) * scale;
            double ll4 = Convert.ToDouble(data["ll4"]) * scale;
            double jtgd = Convert.ToDouble(data["jtgd"]) * scale;//阶梯高度
            double yjbj = Convert.ToDouble(data["yjbj"]) * scale;//圆角半径
            double jtjl = Convert.ToDouble(data["jtjl"]) * scale;//阶梯距离
            double bb = Convert.ToDouble(data["bb"]) * pi / 180;
            double isframe = Convert.ToDouble(data["isframe"]);
            double n = Math.Round(ll3 / scale / 4, 0);
            int n1;
            n1 = (int)n;

            DimensionStyle dimensionStyle = fun.DimStyle(true);
            DimensionStyle dimensionStyle2 = fun.DimStyle(false);

            //坐标
            if (style == "b1")
            {   //坐标b1
                Vector2 v1 = new Vector2(0, oah);//工件侧
                Vector2 v2 = new Vector2(lpr, v1.Y);
                Vector2 v3 = new Vector2(v2.X, radh + dcon / 2);
                Vector2 v4 = new Vector2(v3.X, v3.Y - dcon);
                Vector2 v5 = new Vector2(v4.X, v3.Y - dcon / 2 - h8);
                Vector2 v6 = new Vector2(v2.X - v5.Y / Math.Tan(a), 0);
                Vector2 v7 = new Vector2(0, 0);
                Vector2 v8 = new Vector2(0, v3.Y - dcon / 2 - hf);
                Vector2 v9 = new Vector2(lpr - lf, v8.Y);
                Vector2 v10 = new Vector2(v9.X, v9.Y + h2);
                Vector2 v11 = new Vector2(0, v10.Y);
                Vector2 v12 = new Vector2(v11.X + 2, v11.Y - 2);
                Vector2 v13 = new Vector2(v10.X - 2, v10.Y - 2);
                Vector2 v14 = new Vector2(v13.X, v3.Y - dcon / 2 + 2);
                Vector2 v15 = new Vector2(v12.X, v14.Y);
                Vector2 v16 = new Vector2(v3.X + ll7, v3.Y);
                Vector2 v17 = new Vector2(v16.X, v16.Y - (dcon - hh2));
                Vector2 v18 = new Vector2(v3.X + ll2 - ll3 / 2, v17.Y);
                Vector2 v19 = new Vector2(v18.X + (jtjl - 2 * jtgd) / 2, v18.Y);
                Vector2 v20 = new Vector2(v19.X + jtgd - Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2, v19.Y - jtgd + Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2);
                Vector2 v21 = new Vector2(v20.X + Math.Sqrt(yjbj * yjbj + yjbj * yjbj), v20.Y);
                Vector2 v22 = new Vector2(v19.X + 2 * jtgd, v19.Y);
                Vector2 v23 = new Vector2(v22.X + (jtjl - 2 * jtgd) / 2, v19.Y);
                Vector2 v24 = new Vector2(v18.X + ll3, v19.Y);
                Vector2 v25 = new Vector2(v3.X + ls - ll4, v19.Y);
                Vector2 v26 = new Vector2(v3.X + ls, v19.Y);
                Vector2 v27 = new Vector2(v26.X, v26.Y - hh2);
                Vector2 v28 = new Vector2(v25.X, v25.Y - hh2);
                double l = Math.Sqrt(yjbj * yjbj + yjbj * yjbj);
                double h = yjbj - (Math.Sqrt((yjbj * yjbj) - l * l / 4));
                Vector2 v101 = new Vector2(oal*2, 0);
                Vector2 v102 = new Vector2(oal*2, radh - rhcdl);
                Vector2 v103 = new Vector2(oal*2, radh - hf);
                Vector2 v104 = new Vector2(oal*2, v103.Y + h2);
                Vector2 v105 = new Vector2(oal*2, rhcdu + radh);
                Vector2 v106 = new Vector2(oal*2, oah);
                Vector2 v107 = new Vector2(oal*2 + (oah - v105.Y) / Math.Tan(rhcau), v106.Y);
                Vector2 v108 = new Vector2(oal*2 + oaw - radwof, v107.Y);
                Vector2 v109 = new Vector2(v108.X, v104.Y);
                Vector2 v110 = new Vector2(v109.X, v109.Y - 2);
                Vector2 v111 = new Vector2(v110.X, v14.Y);
                Vector2 v112 = new Vector2(v111.X, radh - radhof);
                Vector2 v113 = new Vector2(v112.X + radwof, v112.Y);
                Vector2 v114 = new Vector2(v113.X, v103.Y);
                Vector2 v115 = new Vector2(v114.X, 0);
                Vector2 v116 = new Vector2(oal*2 + v102.Y / Math.Tan(rhcal), 0);
                Vector2 v117 = new Vector2(oal*2 + oaw - radw, radh);
                Vector2 v118 = new Vector2(v104.X + 2, v104.Y - 2);
                Vector2 v119 = new Vector2(v118.X, v111.Y);
                Vector2 v120 = new Vector2(v117.X, v117.Y + dcon / 2);
                Vector2 v121 = new Vector2(v117.X + dcon / 2, v117.Y);
                Vector2 v122 = new Vector2(v117.X, v117.Y - dcon / 2);
                Vector2 v123 = new Vector2(v117.X - dcon / 2, v117.Y);
                //线段
                Vector2[] Line1 = { v1, v2 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v2, v5 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v5, v6 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v6, v7 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v7, v8 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                Vector2[] Line6 = { v8, v9 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v9, v10 };
                fun.drawBLine(dxf, Line7, 0.3, contour);
                Vector2[] Line8 = { v10, v11 };
                fun.drawBLine(dxf, Line8, 0.3, contour);
                Vector2[] Line9 = { v11, v1 };
                fun.drawBLine(dxf, Line9, 0.3, contour);
                Vector2[] Line10 = { v12, v13 };
                fun.drawBLine(dxf, Line10, 0.3, contour);
                Vector2[] Line11 = { v13, v14 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Vector2[] Line12 = { v14, v15 };
                fun.drawBLine(dxf, Line12, 0.3, contour);
                Vector2[] Line13 = { v15, v12 };
                fun.drawBLine(dxf, Line13, 0.3, contour);
                Vector2[] Line14 = { v3, v16 };
                fun.drawBLine(dxf, Line14, 0.3, contour);
                Vector2[] Line15 = { v16, v17 };
                fun.drawBLine(dxf, Line15, 0.3, contour);
                Vector2[] Line16 = { v17, v18 };
                fun.drawBLine(dxf, Line16, 0.3, contour);
                Vector2[] Line17 = { v18, v19 };
                fun.drawBLine(dxf, Line17, 0.3, contour);
                Vector2[] Line18 = { v19, v20 };
                fun.drawBLine(dxf, Line18, 0.3, contour);
                Vector2[] Line19 = { v21, v22 };
                fun.drawBLine(dxf, Line19, 0.3, contour);
                Vector2[] Line20 = { v22, v23 };
                fun.drawBLine(dxf, Line20, 0.3, contour);
                Vector2[] Line21 = { v24, v26 };
                fun.drawBLine(dxf, Line21, 0.3, contour);
                Vector2[] Line22 = { v25, v28 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                Vector2[] Line23 = { v26, v27 };
                fun.drawBLine(dxf, Line23, 0.3, contour);
                Vector2[] Line24 = { v27, v4 };
                fun.drawBLine(dxf, Line24, 0.3, contour);
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v20));
                Arc1.Vertexes.Add(new LwPolylineVertex(v21));
                Arc1.Vertexes[0].Bulge = 2 * h / l;
                fun.PolyFill(dxf, Arc1, 0.3, contour);
                Line line1 = new Line(v18, v19);
                line1.Layer = contour;
                Line[] linepoarray1 = new Line[1000];
                linepoarray1 = fun.arrayrline(line1, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray1[i] });
                }
                ;
                Line line2 = new Line(v19, v20);
                line2.Layer = contour;
                Line[] linepoarray2 = new Line[1000];
                linepoarray2 = fun.arrayrline(line2, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray2[i] });
                }
                ;
                Line line3 = new Line(v21, v22);
                line3.Layer = contour;
                Line[] linepoarray3 = new Line[1000];
                linepoarray3 = fun.arrayrline(line3, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray3[i] });
                }
                ;
                Line line4 = new Line(v22, v23);
                line4.Layer = contour;
                Line[] linepoarray4 = new Line[1000];
                linepoarray4 = fun.arrayrline(line4, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray4[i] });
                }
                ;
                Arc arc5 = new Arc(new Vector2((v20.X + v21.X) / 2, v20.Y + yjbj - h), yjbj, -135, -45);
                arc5.Layer = contour;
                Arc[] linepoarray5 = new Arc[1000];
                linepoarray5 = fun.arrayrarc(arc5, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray5[i] });
                }
                ;
                Vector2[] Line25 = { v102, v105 };
                fun.drawBLine(dxf, Line25, 0.3, contour);
                Vector2[] Line26 = { v105, v107 };
                fun.drawBLine(dxf, Line26, 0.3, contour);
                Vector2[] Line27 = { v107, v108 };
                fun.drawBLine(dxf, Line27, 0.3, contour);
                Vector2[] Line28 = { v108, v112 };
                fun.drawBLine(dxf, Line28, 0.3, contour);
                Vector2[] Line29 = { v112, v113 };
                fun.drawBLine(dxf, Line29, 0.3, contour);
                Vector2[] Line30 = { v113, v115 };
                fun.drawBLine(dxf, Line30, 0.3, contour);
                Vector2[] Line31 = { v115, v116 };
                fun.drawBLine(dxf, Line31, 0.3, contour);
                Vector2[] Line34 = { v116, v102 };
                fun.drawBLine(dxf, Line34, 0.3, contour);
                Vector2[] Line35 = { v103, v114 };
                fun.drawBLine(dxf, Line35, 0.3, contour);
                Vector2[] Line36 = { v118, v110 };
                fun.drawBLine(dxf, Line36, 0.3, contour);
                Vector2[] Line37 = { v119, v111 };
                fun.drawBLine(dxf, Line37, 0.3, contour);
                Vector2[] Line38 = { v104, v109 };
                fun.drawBLine(dxf, Line38, 0.3, contour);
                Vector2[] Line39 = { v118, v119 };
                fun.drawBLine(dxf, Line39, 0.3, contour);
                Line Line32 = new Line(v116, v101);
                Line32.Layer = dimensioning;
                dxf.AddEntity(Line32);
                Line Line33 = new Line(v107, v106);
                Line33.Layer = dimensioning;
                dxf.AddEntity(Line33);
                LwPolyline Arc10 = new LwPolyline();
                Arc10.Vertexes.Add(new LwPolylineVertex(v121));
                Arc10.Vertexes.Add(new LwPolylineVertex(v123));
                Arc10.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc10, 0, refin, Linetype.Dashed);
                LwPolyline Arc11 = new LwPolyline();
                Arc11.Vertexes.Add(new LwPolylineVertex(v123));
                Arc11.Vertexes.Add(new LwPolylineVertex(v121));
                Arc11.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc11, 0, refin, Linetype.Dashed);
                //文本样式
                double offset = 10;

                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v1, v26),   offset + (v1.Y - v26.Y), 0, dimensionStyle);
                dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v2, v10), offset + (v2.Y - v10.Y), 0, dimensionStyle);
                dim2.SetDimensionLinePosition(new Vector2(v10.X,v10.Y-offset));
                dim2.UserText = "LF="+ Math.Round(lf / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v4, v27),offset, 180, dimensionStyle);
                dim3.UserText = "LS="+ Math.Round(ls / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v5, v7),  offset + (v5.Y - v7.Y)/2, 180, dimensionStyle);
                dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(v3, v4), 7 * offset, 270, dimensionStyle);
                dim5.SetDimensionLinePosition(new Vector2(v27.X + offset, v27.Y));
                dim5.UserText = "DCON="+ Math.Round(dcon / scale, 2);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(v107, v116), 4 * offset + (v107.X + v116.X) / 2 - v101.X, 90, dimensionStyle);
                dim6.UserText = "OAH="+ Math.Round(oah / scale, 2);
                dxf.AddEntity(dim6);

                LinearDimension dim7 = new LinearDimension(new Line(v105, v117), offset + (v117.X + v105.X) / 2 - v105.X, 90, dimensionStyle);
                dim7.UserText = "RHCDU="+ Math.Round(rhcdu / scale, 2);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(v117, v102), offset + (v117.X + v102.X) / 2 - v102.X, 90, dimensionStyle);
                dim8.UserText = "RHCDL="+ Math.Round(rhcdl / scale, 2);
                dxf.AddEntity(dim8);

                LinearDimension dim9 = new LinearDimension(new Line(v117, v116), 2 * offset + (v116.X + v117.X) / 2 - v105.X, 90, dimensionStyle);
                dim9.UserText = "RADH="+ Math.Round(radh / scale, 2);
                dxf.AddEntity(dim9);

                LinearDimension dim10 = new LinearDimension(new Line(v115, v102), 2 * offset + (v115.Y + v102.Y) / 2 - v115.Y, 180, dimensionStyle);
                dim10.UserText = "OAW="+ Math.Round(oaw / scale, 2);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v117, v115), offset + (v115.Y + v117.Y) / 2 - v115.Y, 180, dimensionStyle);
                dim11.UserText = "RADW="+ Math.Round(radw / scale, 2);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(v108, v113), offset + v108.Y - (v108.Y + v113.Y) / 2, 0, dimensionStyle);
                dim12.UserText = "RADWOF="+ Math.Round(radwof / scale, 2);
                dxf.AddEntity(dim12);

                LinearDimension dim13 = new LinearDimension(new Line(v117, v113), offset + v113.X - (v117.X + v113.X) / 2, 270, dimensionStyle2);
                dim13.UserText = "RADHOF="+ Math.Round(radhof / scale, 2);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v117, v114), 2 * offset + v114.X - (v117.X + v114.X) / 2, 270, dimensionStyle);
                dim14.UserText = "HF="+ Math.Round(hf / scale, 2);
                dxf.AddEntity(dim14);

                Angular2LineDimension dim15 = new Angular2LineDimension(new Line(v107, v106), new Line(v107, v105), 2 * offset, dimensionStyle2);
                dim15.UserText = String.Format("RHCAU={0}°", rhcau / (pi / 180));
                dxf.AddEntity(dim15);

                Angular2LineDimension dim16 = new Angular2LineDimension(new Line(v116, v102), new Line(v116, v101), 2 * offset, dimensionStyle2);
                dim16.UserText = String.Format("RHCAL={0}°", rhcal / (pi / 180));
                dxf.AddEntity(dim16);

                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2((-210 + lpr) / 2, 148.5 + oah / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }
            if (style == "b2")
            {   //坐标b2
                Vector2 v1 = new Vector2(0, oah);//工件侧
                Vector2 v2 = new Vector2(lpr, v1.Y);
                Vector2 v3 = new Vector2(v2.X, radh + dcon / 2);
                Vector2 v4 = new Vector2(v3.X, v3.Y - dcon);
                Vector2 v5 = new Vector2(v4.X, v3.Y - dcon / 2 - h8);
                Vector2 v6 = new Vector2(v2.X - v5.Y / Math.Tan(a), 0);
                Vector2 v7 = new Vector2(0, 0);
                Vector2 v8 = new Vector2(0, v3.Y - dcon / 2 - hf);
                Vector2 v9 = new Vector2(lpr - lf, v8.Y);
                Vector2 v10 = new Vector2(v9.X, v9.Y + h2);
                Vector2 v11 = new Vector2(0, v10.Y);
                Vector2 v12 = new Vector2(v11.X + 2, v11.Y - 2);
                Vector2 v13 = new Vector2(v10.X - 2, v10.Y - 2);
                Vector2 v14 = new Vector2(v13.X, v3.Y - dcon / 2 + 2);
                Vector2 v15 = new Vector2(v12.X, v14.Y);
                Vector2 v16 = new Vector2(v3.X + ll7, v3.Y);
                Vector2 v17 = new Vector2(v16.X, v16.Y - (dcon - hh2));
                Vector2 v18 = new Vector2(v3.X + ll2 - ll3 / 2, v17.Y);
                Vector2 v19 = new Vector2(v18.X + (jtjl - 2 * jtgd) / 2, v18.Y);
                Vector2 v20 = new Vector2(v19.X + jtgd - Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2, v19.Y - jtgd + Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2);
                Vector2 v21 = new Vector2(v20.X + Math.Sqrt(yjbj * yjbj + yjbj * yjbj), v20.Y);
                Vector2 v22 = new Vector2(v19.X + 2 * jtgd, v19.Y);
                Vector2 v23 = new Vector2(v22.X + (jtjl - 2 * jtgd) / 2, v19.Y);
                Vector2 v24 = new Vector2(v18.X + ll3, v19.Y);
                Vector2 v25 = new Vector2(v3.X + ls - ll4, v19.Y);
                Vector2 v26 = new Vector2(v3.X + ls, v19.Y);
                Vector2 v27 = new Vector2(v26.X, v26.Y - hh2);
                Vector2 v28 = new Vector2(v25.X, v25.Y - hh2);
                double l = Math.Sqrt(yjbj * yjbj + yjbj * yjbj);
                double h = yjbj - (Math.Sqrt((yjbj * yjbj) - l * l / 4));
                Vector2 v101 = new Vector2(oal*2, 0);
                Vector2 v102 = new Vector2(oal*2, radh - hf);
                Vector2 v103 = new Vector2(oal*2, radh - radhof);
                Vector2 v104 = new Vector2(oal*2 + radwof, v103.Y);
                Vector2 v105 = new Vector2(v104.X, radh + 2);
                Vector2 v107 = new Vector2(v105.X, v102.Y + h2);
                Vector2 v106 = new Vector2(v107.X, v107.Y - 2);
                Vector2 v108 = new Vector2(v106.X, oah);
                Vector2 v109 = new Vector2(oal*2 + oaw - (oah - rhcdu - radh) / Math.Tan(rhcau), v108.Y);
                Vector2 v110 = new Vector2(oal*2 + oaw, v109.Y);
                Vector2 v111 = new Vector2(v110.X, rhcdu + radh);
                Vector2 v112 = new Vector2(v111.X, v107.Y);
                Vector2 v113 = new Vector2(v112.X, v102.Y);
                Vector2 v114 = new Vector2(v113.X, radh - rhcdl);
                Vector2 v115 = new Vector2(oal*2 + oaw - (radh - rhcdl) / Math.Tan(rhcal), 0);
                Vector2 v116 = new Vector2(v112.X - 2, v106.Y);
                Vector2 v117 = new Vector2(v116.X, v105.Y);
                Vector2 v118 = new Vector2(oal*2 + radw, radh);
                Vector2 v119 = new Vector2(v118.X - dcon / 2, v118.Y);
                Vector2 v120 = new Vector2(v118.X + dcon / 2, v118.Y);
                Vector2 v121 = new Vector2(v114.X, 0);
                //线段
                Vector2[] Line1 = { v1, v2 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v2, v5 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v5, v6 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v6, v7 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v7, v8 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                Vector2[] Line6 = { v8, v9 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v9, v10 };
                fun.drawBLine(dxf, Line7, 0.3, contour);
                Vector2[] Line8 = { v10, v11 };
                fun.drawBLine(dxf, Line8, 0.3, contour);
                Vector2[] Line9 = { v11, v1 };
                fun.drawBLine(dxf, Line9, 0.3, contour);
                Vector2[] Line10 = { v12, v13 };
                fun.drawBLine(dxf, Line10, 0.3, contour);
                Vector2[] Line11 = { v13, v14 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Vector2[] Line12 = { v14, v15 };
                fun.drawBLine(dxf, Line12, 0.3, contour);
                Vector2[] Line13 = { v15, v12 };
                fun.drawBLine(dxf, Line13, 0.3, contour);
                Vector2[] Line14 = { v3, v16 };
                fun.drawBLine(dxf, Line14, 0.3, contour);
                Vector2[] Line15 = { v16, v17 };
                fun.drawBLine(dxf, Line15, 0.3, contour);
                Vector2[] Line16 = { v17, v18 };
                fun.drawBLine(dxf, Line16, 0.3, contour);
                Vector2[] Line17 = { v18, v19 };
                fun.drawBLine(dxf, Line17, 0.3, contour);
                Vector2[] Line18 = { v19, v20 };
                fun.drawBLine(dxf, Line18, 0.3, contour);
                Vector2[] Line19 = { v21, v22 };
                fun.drawBLine(dxf, Line19, 0.3, contour);
                Vector2[] Line20 = { v22, v23 };
                fun.drawBLine(dxf, Line20, 0.3, contour);
                Vector2[] Line21 = { v24, v26 };
                fun.drawBLine(dxf, Line21, 0.3, contour);
                Vector2[] Line22 = { v25, v28 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                Vector2[] Line23 = { v26, v27 };
                fun.drawBLine(dxf, Line23, 0.3, contour);
                Vector2[] Line24 = { v27, v4 };
                fun.drawBLine(dxf, Line24, 0.3, contour);
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v20));
                Arc1.Vertexes.Add(new LwPolylineVertex(v21));
                Arc1.Vertexes[0].Bulge = 2 * h / l;
                fun.PolyFill(dxf, Arc1, 0.3, contour);
                Line line1 = new Line(v18, v19);
                line1.Layer = contour;
                Line[] linepoarray1 = new Line[1000];
                linepoarray1 = fun.arrayrline(line1, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray1[i] });
                }
                ;
                Line line2 = new Line(v19, v20);
                line2.Layer = contour;
                Line[] linepoarray2 = new Line[1000];
                linepoarray2 = fun.arrayrline(line2, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray2[i] });
                }
                ;
                Line line3 = new Line(v21, v22);
                line3.Layer = contour;
                Line[] linepoarray3 = new Line[1000];
                linepoarray3 = fun.arrayrline(line3, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray3[i] });
                }
                ;
                Line line4 = new Line(v22, v23);
                line4.Layer = contour;
                Line[] linepoarray4 = new Line[1000];
                linepoarray4 = fun.arrayrline(line4, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray4[i] });
                }
                ;
                Arc arc5 = new Arc(new Vector2((v20.X + v21.X) / 2, v20.Y + yjbj - h), yjbj, -135, -45);
                arc5.Layer = contour;
                Arc[] linepoarray5 = new Arc[1000];
                linepoarray5 = fun.arrayrarc(arc5, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray5[i] });
                }
                ;
                Vector2[] Line25 = { v101, v103 };
                fun.drawBLine(dxf, Line25, 0.3, contour);
                Vector2[] Line26 = { v103, v104 };
                fun.drawBLine(dxf, Line26, 0.3, contour);
                Vector2[] Line27 = { v104, v108 };
                fun.drawBLine(dxf, Line27, 0.3, contour);
                Vector2[] Line28 = { v108, v109 };
                fun.drawBLine(dxf, Line28, 0.3, contour);
                Vector2[] Line29 = { v109, v111 };
                fun.drawBLine(dxf, Line29, 0.3, contour);
                Vector2[] Line30 = { v111, v114 };
                fun.drawBLine(dxf, Line30, 0.3, contour);
                Vector2[] Line31 = { v114, v115 };
                fun.drawBLine(dxf, Line31, 0.3, contour);
                Vector2[] Line34 = { v115, v101 };
                fun.drawBLine(dxf, Line34, 0.3, contour);
                Vector2[] Line35 = { v102, v113 };
                fun.drawBLine(dxf, Line35, 0.3, contour);
                Vector2[] Line36 = { v105, v117 };
                fun.drawBLine(dxf, Line36, 0.3, contour);
                Vector2[] Line37 = { v106, v116 };
                fun.drawBLine(dxf, Line37, 0.3, contour);
                Vector2[] Line38 = { v107, v112 };
                fun.drawBLine(dxf, Line38, 0.3, contour);
                Line Line32 = new Line(v109, v110);
                Line32.Layer = dimensioning;
                dxf.AddEntity(Line32);
                Line Line33 = new Line(v115, v121);
                Line33.Layer = dimensioning;
                dxf.AddEntity(Line33);
                LwPolyline Arc10 = new LwPolyline();
                Arc10.Vertexes.Add(new LwPolylineVertex(v120));
                Arc10.Vertexes.Add(new LwPolylineVertex(v119));
                Arc10.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc10, 0, refin, Linetype.Dashed);
                LwPolyline Arc11 = new LwPolyline();
                Arc11.Vertexes.Add(new LwPolylineVertex(v119));
                Arc11.Vertexes.Add(new LwPolylineVertex(v120));
                Arc11.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc11, 0, refin, Linetype.Dashed);
                //文本样式


                double offset = 10;

                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v1, v26), 3 * offset + (v1.Y - v26.Y), 0, dimensionStyle);
                dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v2, v10), offset + (v2.Y - v10.Y), 0, dimensionStyle);
                dim2.UserText = "LF="+ Math.Round(lf / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v4, v27), offset, 180, dimensionStyle);
                dim3.UserText = "LS="+ Math.Round(ls / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v5, v7),  offset + (v5.Y - v7.Y)/2, 180, dimensionStyle);
                dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(v3, v4), ls+ offset, 270, dimensionStyle);
                dim5.UserText = "DCON="+ Math.Round(dcon / scale, 2);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(v109, v115), 4 * offset + v111.X - (v109.X + v115.X) / 2, 90, dimensionStyle);
                dim6.SetDimensionLinePosition(new Vector2(v109.X-offset,0));
                dim6.UserText = "OAH="+ Math.Round(oah / scale, 2);
                dxf.AddEntity(dim6);

                LinearDimension dim7 = new LinearDimension(new Line(v111, v118), offset + v111.X - (v111.X + v118.X) / 2, 270, dimensionStyle);
                dim7.UserText = "RHCDU="+ Math.Round(rhcdu / scale, 2);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(v114, v118), offset + v114.X - (v114.X + v118.X) / 2, 270, dimensionStyle);
                dim8.UserText = "RHCDL="+ Math.Round(rhcdl / scale, 2);
                dxf.AddEntity(dim8);

                LinearDimension dim9 = new LinearDimension(new Line(v115, v118), 2 * offset + v114.X - (v115.X + v118.X) / 2, 270, dimensionStyle);
                dim9.UserText = "RADH="+ Math.Round(radh / scale, 2);
                dxf.AddEntity(dim9);

                LinearDimension dim10 = new LinearDimension(new Line(v114, v101), 2 * offset + (v101.Y + v114.Y) / 2 - v101.Y, 180, dimensionStyle);
                dim10.UserText = "OAW="+ Math.Round(oaw / scale, 2);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v118, v101), offset + (v118.Y + v101.Y) / 2 - v101.Y, 180, dimensionStyle);
                dim11.UserText = "RADW="+ Math.Round(radw / scale, 2);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(v103, v108), offset + v108.Y - (v103.Y + v108.Y) / 2, 0, dimensionStyle);
                dim12.UserText = "RADWOF="+ Math.Round(radwof / scale, 2);
                dxf.AddEntity(dim12);

                LinearDimension dim13 = new LinearDimension(new Line(v118, v103), offset + (v118.X + v103.X) / 2 - v103.X, 90, dimensionStyle2);
                dim13.UserText = "RADHOF="+ Math.Round(radhof / scale, 2);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v118, v102), 2 * offset + (v118.X + v102.X) / 2 - v102.X, 90, dimensionStyle);
                dim14.UserText = "HF="+ Math.Round(hf / scale, 2);
                dxf.AddEntity(dim14);

                Angular2LineDimension dim15 = new Angular2LineDimension(new Line(v109, v110), new Line(v109, v111), 2 * offset, dimensionStyle2);
                dim15.UserText = String.Format("RHCAU={0}°", rhcau / (pi / 180));
                dxf.AddEntity(dim15);

                Angular2LineDimension dim16 = new Angular2LineDimension(new Line(v115, v114), new Line(v115, v121), 2 * offset, dimensionStyle2);
                dim16.UserText = String.Format("RHCAL={0}°", rhcal / (pi / 180));
                dxf.AddEntity(dim16);

                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2((-210 + lpr) / 2, 148.5 + oah / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }
            if (style == "b3")
            {   //坐标b1
                Vector2 v1 = new Vector2(0, 0);//工件侧
                Vector2 v2 = new Vector2(lpr, v1.Y);
                Vector2 v3 = new Vector2(v2.X, h7 - dcon / 2);
                Vector2 v4 = new Vector2(v3.X, v3.Y + dcon);
                Vector2 v5 = new Vector2(v4.X, h7 + h9);
                Vector2 v6 = new Vector2(v2.X - (oah - v5.Y) / Math.Tan(a), oah);
                Vector2 v7 = new Vector2(0, v6.Y);
                Vector2 v8 = new Vector2(0, h7 + hf);
                Vector2 v9 = new Vector2(lpr - lf, v8.Y);
                Vector2 v10 = new Vector2(v9.X, v9.Y - h2);
                Vector2 v11 = new Vector2(0, v10.Y);
                Vector2 v12 = new Vector2(v11.X + 2, v11.Y + 2);
                Vector2 v13 = new Vector2(v10.X - 2, v12.Y);
                Vector2 v14 = new Vector2(v13.X, v3.Y + dcon / 2 - 2);
                Vector2 v15 = new Vector2(v12.X, v14.Y);

                Vector2 v16 = new Vector2(lpr + ll7, h7 + dcon / 2);
                Vector2 v17 = new Vector2(v16.X, v16.Y - (dcon - hh2));
                Vector2 v18 = new Vector2(lpr + ll2 - ll3 / 2, v17.Y);
                Vector2 v19 = new Vector2(v18.X + (jtjl - 2 * jtgd) / 2, v18.Y);
                Vector2 v20 = new Vector2(v19.X + jtgd - Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2, v19.Y - jtgd + Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2);
                Vector2 v21 = new Vector2(v20.X + Math.Sqrt(yjbj * yjbj + yjbj * yjbj), v20.Y);
                Vector2 v22 = new Vector2(v19.X + 2 * jtgd, v19.Y);
                Vector2 v23 = new Vector2(v22.X + (jtjl - 2 * jtgd) / 2, v19.Y);
                Vector2 v24 = new Vector2(v18.X + ll3, v19.Y);
                Vector2 v25 = new Vector2(lpr + ls - ll4, v19.Y);
                Vector2 v26 = new Vector2(lpr + ls, v19.Y);
                Vector2 v27 = new Vector2(v26.X, v26.Y - hh2);
                Vector2 v28 = new Vector2(v25.X, v25.Y - hh2);
                double l = Math.Sqrt(yjbj * yjbj + yjbj * yjbj);
                double h = yjbj - (Math.Sqrt((yjbj * yjbj) - l * l / 4));

                Vector2 v101 = new Vector2(oal*2, 0);
                Vector2 v102 = new Vector2(oal*2, oah - radh - rhcdl);
                Vector2 v104 = new Vector2(oal*2, h7 + hf);
                Vector2 v103 = new Vector2(oal*2, h7 + hf - h2);
                Vector2 v105 = new Vector2(oal*2, h7 + rhcdl);
                Vector2 v106 = new Vector2(oal*2, oah);
                Vector2 v107 = new Vector2(oal*2 + (oah - v105.Y) / Math.Tan(rhcal), v106.Y);
                Vector2 v108 = new Vector2(oal*2 + oaw, v107.Y);
                Vector2 v109 = new Vector2(v108.X, v104.Y);
                Vector2 v110 = new Vector2(v109.X, oah - radh + radhof);
                Vector2 v111 = new Vector2(v110.X - radwof, v110.Y);
                Vector2 v112 = new Vector2(v111.X, oah - radh - 2);
                Vector2 v114 = new Vector2(v112.X, v103.Y);
                Vector2 v113 = new Vector2(v114.X, v114.Y + 2);
                Vector2 v115 = new Vector2(v114.X, 0);
                Vector2 v116 = new Vector2(oal*2 + v102.Y / Math.Tan(rhcau), 0);
                Vector2 v117 = new Vector2(v103.X + 2, v112.Y);
                Vector2 v118 = new Vector2(v117.X, v113.Y);
                Vector2 v119 = new Vector2(oal*2 + oaw - radw, h7);
                Vector2 v120 = new Vector2(v119.X - dcon / 2, v119.Y);
                Vector2 v121 = new Vector2(v119.X + dcon / 2, v119.Y);

                //线段
                Vector2[] Line1 = { v1, v2 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v2, v5 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v5, v6 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v6, v7 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v7, v8 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                Vector2[] Line6 = { v8, v9 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v9, v10 };
                fun.drawBLine(dxf, Line7, 0.3, contour);
                Vector2[] Line8 = { v10, v11 };
                fun.drawBLine(dxf, Line8, 0.3, contour);
                Vector2[] Line9 = { v11, v1 };
                fun.drawBLine(dxf, Line9, 0.3, contour);
                Vector2[] Line10 = { v12, v13 };
                fun.drawBLine(dxf, Line10, 0.3, contour);
                Vector2[] Line11 = { v13, v14 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Vector2[] Line12 = { v14, v15 };
                fun.drawBLine(dxf, Line12, 0.3, contour);
                Vector2[] Line13 = { v15, v12 };
                fun.drawBLine(dxf, Line13, 0.3, contour);
                Vector2[] Line14 = { v4, v16 };
                fun.drawBLine(dxf, Line14, 0.3, contour);
                Vector2[] Line15 = { v16, v17 };
                fun.drawBLine(dxf, Line15, 0.3, contour);
                Vector2[] Line16 = { v17, v18 };
                fun.drawBLine(dxf, Line16, 0.3, contour);
                Vector2[] Line17 = { v18, v19 };
                fun.drawBLine(dxf, Line17, 0.3, contour);
                Vector2[] Line18 = { v19, v20 };
                fun.drawBLine(dxf, Line18, 0.3, contour);
                Vector2[] Line19 = { v21, v22 };
                fun.drawBLine(dxf, Line19, 0.3, contour);
                Vector2[] Line20 = { v22, v23 };
                fun.drawBLine(dxf, Line20, 0.3, contour);
                Vector2[] Line21 = { v24, v26 };
                fun.drawBLine(dxf, Line21, 0.3, contour);
                Vector2[] Line22 = { v25, v28 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                Vector2[] Line23 = { v26, v27 };
                fun.drawBLine(dxf, Line23, 0.3, contour);
                Vector2[] Line24 = { v27, v3 };
                fun.drawBLine(dxf, Line24, 0.3, contour);
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v20));
                Arc1.Vertexes.Add(new LwPolylineVertex(v21));
                Arc1.Vertexes[0].Bulge = 2 * h / l;
                fun.PolyFill(dxf, Arc1, 0.3, contour);
                Line line1 = new Line(v18, v19);
                line1.Layer = contour;
                Line[] linepoarray1 = new Line[1000];
                linepoarray1 = fun.arrayrline(line1, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray1[i] });
                }
                ;
                Line line2 = new Line(v19, v20);
                line2.Layer = contour;
                Line[] linepoarray2 = new Line[1000];
                linepoarray2 = fun.arrayrline(line2, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray2[i] });
                }
                ;
                Line line3 = new Line(v21, v22);
                line3.Layer = contour;
                Line[] linepoarray3 = new Line[1000];
                linepoarray3 = fun.arrayrline(line3, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray3[i] });
                }
                ;
                Line line4 = new Line(v22, v23);
                line4.Layer = contour;
                Line[] linepoarray4 = new Line[1000];
                linepoarray4 = fun.arrayrline(line4, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray4[i] });
                }
                ;
                Arc arc5 = new Arc(new Vector2((v20.X + v21.X) / 2, v20.Y + yjbj - h), yjbj, -135, -45);
                arc5.Layer = contour;
                Arc[] linepoarray5 = new Arc[1000];
                linepoarray5 = fun.arrayrarc(arc5, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray5[i] });
                }
                ;
                Vector2[] Line25 = { v102, v105 };
                fun.drawBLine(dxf, Line25, 0.3, contour);
                Vector2[] Line26 = { v105, v107 };
                fun.drawBLine(dxf, Line26, 0.3, contour);
                Vector2[] Line27 = { v107, v108 };
                fun.drawBLine(dxf, Line27, 0.3, contour);
                Vector2[] Line28 = { v108, v110 };
                fun.drawBLine(dxf, Line28, 0.3, contour);
                Vector2[] Line29 = { v110, v111 };
                fun.drawBLine(dxf, Line29, 0.3, contour);
                Vector2[] Line30 = { v111, v115 };
                fun.drawBLine(dxf, Line30, 0.3, contour);
                Vector2[] Line31 = { v115, v116 };
                fun.drawBLine(dxf, Line31, 0.3, contour);
                Vector2[] Line34 = { v116, v102 };
                fun.drawBLine(dxf, Line34, 0.3, contour);
                Vector2[] Line35 = { v103, v114 };
                fun.drawBLine(dxf, Line35, 0.3, contour);
                Vector2[] Line36 = { v118, v113 };
                fun.drawBLine(dxf, Line36, 0.3, contour);
                Vector2[] Line37 = { v117, v112 };
                fun.drawBLine(dxf, Line37, 0.3, contour);
                Vector2[] Line38 = { v104, v109 };
                fun.drawBLine(dxf, Line38, 0.3, contour);
                Vector2[] Line39 = { v117, v118 };
                fun.drawBLine(dxf, Line39, 0.3, contour);
                Line Line32 = new Line(v116, v101);
                Line32.Layer = dimensioning;
                dxf.AddEntity(Line32);
                Line Line33 = new Line(v107, v106);
                Line33.Layer = dimensioning;
                dxf.AddEntity(Line33);
                LwPolyline Arc10 = new LwPolyline();
                Arc10.Vertexes.Add(new LwPolylineVertex(v121));
                Arc10.Vertexes.Add(new LwPolylineVertex(v120));
                Arc10.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc10, 0, refin, Linetype.Dashed);
                LwPolyline Arc11 = new LwPolyline();
                Arc11.Vertexes.Add(new LwPolylineVertex(v120));
                Arc11.Vertexes.Add(new LwPolylineVertex(v121));
                Arc11.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc11, 0, refin, Linetype.Dashed);
                //文本样式

                double offset = 10;

                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v1, v27), 2 * offset + (v27.Y - v1.Y), 180, dimensionStyle);
                dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v5, v9), -offset - (v5.Y - v9.Y)/2, 0, dimensionStyle);
                dim2.UserText = "LF="+ Math.Round(lf / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v3, v27), offset + v3.Y - v2.Y, 180, dimensionStyle);
                dim3.UserText = "LS="+ Math.Round(ls / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v1, v2), offset + (v2.Y - v1.Y), 180, dimensionStyle);
                dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(v3, v4), ls+ offset, 270, dimensionStyle);
                dim5.UserText = "DCON="+ Math.Round(dcon / scale, 2);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(v107, v116), 4 * offset + (v107.X + v116.X) / 2 - v101.X, 90, dimensionStyle);
                dim6.UserText = "OAH="+ Math.Round(oah / scale, 2);
                dxf.AddEntity(dim6);

                LinearDimension dim7 = new LinearDimension(new Line(v102, v119), offset + (v119.X + v102.X) / 2 - v102.X, 90, dimensionStyle);
                dim7.UserText = "RHCDU="+ Math.Round(rhcdu / scale, 2);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(v119, v105), offset + (v119.X + v105.X) / 2 - v105.X, 90, dimensionStyle);
                dim8.UserText = "RHCDL="+ Math.Round(rhcdl / scale, 2);
                dxf.AddEntity(dim8);

                LinearDimension dim9 = new LinearDimension(new Line(v119, v107), 2 * offset + (v119.X + v107.X) / 2 - v106.X, 90, dimensionStyle);
                dim9.UserText = "RADH="+ Math.Round(radh / scale, 2);
                dxf.AddEntity(dim9);

                LinearDimension dim10 = new LinearDimension(new Line(v115, v102), 2 * offset + (v115.Y + v102.Y) / 2 - v115.Y, 180, dimensionStyle);
                dim10.UserText = "OAW="+ Math.Round(oaw / scale, 2);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v119, v115), offset + (v115.Y + v119.Y) / 2 - v115.Y, 180, dimensionStyle);
                dim11.UserText = "RADW="+ Math.Round(radw / scale, 2);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(v115, v110), offset + (v110.Y + v115.Y) / 2 - v115.Y, 180, dimensionStyle);
                dim12.UserText = "RADWOF="+ Math.Round(radwof / scale, 2);
                dxf.AddEntity(dim12);

                LinearDimension dim13 = new LinearDimension(new Line(v119, v110), offset + v110.X - (v110.X + v119.X) / 2, 270, dimensionStyle2);
                dim13.UserText = "RADHOF="+ Math.Round(radhof / scale, 2);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v119, v109), 2 * offset + v109.X - (v119.X + v109.X) / 2, 270, dimensionStyle);
                dim14.UserText = "HF="+ Math.Round(hf / scale, 2);
                dxf.AddEntity(dim14);

                Angular2LineDimension dim15 = new Angular2LineDimension(new Line(v107, v106), new Line(v107, v105), 2 * offset, dimensionStyle2);
                dim15.UserText = String.Format("RHCAU={0}°", rhcau / (pi / 180));
                dxf.AddEntity(dim15);

                Angular2LineDimension dim16 = new Angular2LineDimension(new Line(v116, v102), new Line(v116, v101), 2 * offset, dimensionStyle2);
                dim16.UserText = String.Format("RHCAL={0}°", rhcal / (pi / 180));
                dxf.AddEntity(dim16);

                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2((-210 + lpr) / 2, 148.5 + oah / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }
            if (style == "b4")
            {   //坐标b1
                Vector2 v1 = new Vector2(0, 0);//工件侧
                Vector2 v2 = new Vector2(lpr, v1.Y);
                Vector2 v3 = new Vector2(v2.X, h7 - dcon / 2);
                Vector2 v4 = new Vector2(v3.X, v3.Y + dcon);
                Vector2 v5 = new Vector2(v4.X, h7 + h9);
                Vector2 v6 = new Vector2(v2.X - (oah - v5.Y) / Math.Tan(a), oah);
                Vector2 v7 = new Vector2(0, v6.Y);
                Vector2 v8 = new Vector2(0, h7 + hf);
                Vector2 v9 = new Vector2(lpr - lf, v8.Y);
                Vector2 v10 = new Vector2(v9.X, v9.Y - h2);
                Vector2 v11 = new Vector2(0, v10.Y);
                Vector2 v12 = new Vector2(v11.X + 2, v11.Y + 2);
                Vector2 v13 = new Vector2(v10.X - 2, v12.Y);
                Vector2 v14 = new Vector2(v13.X, v3.Y + dcon / 2 - 2);
                Vector2 v15 = new Vector2(v12.X, v14.Y);

                Vector2 v16 = new Vector2(lpr + ll7, h7 + dcon / 2);
                Vector2 v17 = new Vector2(v16.X, v16.Y - (dcon - hh2));
                Vector2 v18 = new Vector2(lpr + ll2 - ll3 / 2, v17.Y);
                Vector2 v19 = new Vector2(v18.X + (jtjl - 2 * jtgd) / 2, v18.Y);
                Vector2 v20 = new Vector2(v19.X + jtgd - Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2, v19.Y - jtgd + Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2);
                Vector2 v21 = new Vector2(v20.X + Math.Sqrt(yjbj * yjbj + yjbj * yjbj), v20.Y);
                Vector2 v22 = new Vector2(v19.X + 2 * jtgd, v19.Y);
                Vector2 v23 = new Vector2(v22.X + (jtjl - 2 * jtgd) / 2, v19.Y);
                Vector2 v24 = new Vector2(v18.X + ll3, v19.Y);
                Vector2 v25 = new Vector2(lpr + ls - ll4, v19.Y);
                Vector2 v26 = new Vector2(lpr + ls, v19.Y);
                Vector2 v27 = new Vector2(v26.X, v26.Y - hh2);
                Vector2 v28 = new Vector2(v25.X, v25.Y - hh2);
                double l = Math.Sqrt(yjbj * yjbj + yjbj * yjbj);
                double h = yjbj - (Math.Sqrt((yjbj * yjbj) - l * l / 4));

                Vector2 v101 = new Vector2(oal*2 + radwof, 0);
                Vector2 v102 = new Vector2(v101.X, h7 + hf - h2);
                Vector2 v103 = new Vector2(v102.X, h7 + hf - h2 + 2);
                Vector2 v104 = new Vector2(v103.X, oah - radh - 2);
                Vector2 v105 = new Vector2(v104.X, oah - radh + radhof);
                Vector2 v106 = new Vector2(oal*2, oah - radh + radhof);
                Vector2 v107 = new Vector2(oal*2, h7 + hf);
                Vector2 v108 = new Vector2(oal*2, oah);
                Vector2 v109 = new Vector2(oal*2 + oaw - (oah - h7 - rhcdl) / Math.Tan(rhcal), v108.Y);
                Vector2 v110 = new Vector2(oal*2 + oaw, v109.Y);
                Vector2 v111 = new Vector2(v110.X, h7 + rhcdl);
                Vector2 v112 = new Vector2(v111.X, v107.Y);
                Vector2 v113 = new Vector2(v112.X, v102.Y);
                Vector2 v114 = new Vector2(v113.X, oah - radh - rhcdl);
                Vector2 v115 = new Vector2(v114.X, 0);
                Vector2 v116 = new Vector2(oal*2 + oaw - v114.Y / Math.Tan(rhcau), 0);
                Vector2 v117 = new Vector2(v113.X - 2, v104.Y);
                Vector2 v118 = new Vector2(v117.X, v103.Y);
                Vector2 v119 = new Vector2(oal*2 + radw, h7);
                Vector2 v120 = new Vector2(v119.X - dcon / 2, v119.Y);
                Vector2 v121 = new Vector2(v119.X + dcon / 2, v119.Y);
                //线段
                Vector2[] Line1 = { v1, v2 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v2, v5 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v5, v6 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v6, v7 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v7, v8 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                Vector2[] Line6 = { v8, v9 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v9, v10 };
                fun.drawBLine(dxf, Line7, 0.3, contour);
                Vector2[] Line8 = { v10, v11 };
                fun.drawBLine(dxf, Line8, 0.3, contour);
                Vector2[] Line9 = { v11, v1 };
                fun.drawBLine(dxf, Line9, 0.3, contour);
                Vector2[] Line10 = { v12, v13 };
                fun.drawBLine(dxf, Line10, 0.3, contour);
                Vector2[] Line11 = { v13, v14 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Vector2[] Line12 = { v14, v15 };
                fun.drawBLine(dxf, Line12, 0.3, contour);
                Vector2[] Line13 = { v15, v12 };
                fun.drawBLine(dxf, Line13, 0.3, contour);
                Vector2[] Line14 = { v4, v16 };
                fun.drawBLine(dxf, Line14, 0.3, contour);
                Vector2[] Line15 = { v16, v17 };
                fun.drawBLine(dxf, Line15, 0.3, contour);
                Vector2[] Line16 = { v17, v18 };
                fun.drawBLine(dxf, Line16, 0.3, contour);
                Vector2[] Line17 = { v18, v19 };
                fun.drawBLine(dxf, Line17, 0.3, contour);
                Vector2[] Line18 = { v19, v20 };
                fun.drawBLine(dxf, Line18, 0.3, contour);
                Vector2[] Line19 = { v21, v22 };
                fun.drawBLine(dxf, Line19, 0.3, contour);
                Vector2[] Line20 = { v22, v23 };
                fun.drawBLine(dxf, Line20, 0.3, contour);
                Vector2[] Line21 = { v24, v26 };
                fun.drawBLine(dxf, Line21, 0.3, contour);
                Vector2[] Line22 = { v25, v28 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                Vector2[] Line23 = { v26, v27 };
                fun.drawBLine(dxf, Line23, 0.3, contour);
                Vector2[] Line24 = { v27, v3 };
                fun.drawBLine(dxf, Line24, 0.3, contour);
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v20));
                Arc1.Vertexes.Add(new LwPolylineVertex(v21));
                Arc1.Vertexes[0].Bulge = 2 * h / l;
                fun.PolyFill(dxf, Arc1, 0.3, contour);
                Line line1 = new Line(v18, v19);
                line1.Layer = contour;
                Line[] linepoarray1 = new Line[1000];
                linepoarray1 = fun.arrayrline(line1, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray1[i] });
                }
                ;
                Line line2 = new Line(v19, v20);
                line2.Layer = contour;
                Line[] linepoarray2 = new Line[1000];
                linepoarray2 = fun.arrayrline(line2, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray2[i] });
                }
                ;
                Line line3 = new Line(v21, v22);
                line3.Layer = contour;
                Line[] linepoarray3 = new Line[1000];
                linepoarray3 = fun.arrayrline(line3, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray3[i] });
                }
                ;
                Line line4 = new Line(v22, v23);
                line4.Layer = contour;
                Line[] linepoarray4 = new Line[1000];
                linepoarray4 = fun.arrayrline(line4, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray4[i] });
                }
                ;
                Arc arc5 = new Arc(new Vector2((v20.X + v21.X) / 2, v20.Y + yjbj - h), yjbj, -135, -45);
                arc5.Layer = contour;
                Arc[] linepoarray5 = new Arc[1000];
                linepoarray5 = fun.arrayrarc(arc5, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray5[i] });
                }
                ;
                Vector2[] Line25 = { v101, v105 };
                fun.drawBLine(dxf, Line25, 0.3, contour);
                Vector2[] Line26 = { v105, v106 };
                fun.drawBLine(dxf, Line26, 0.3, contour);
                Vector2[] Line27 = { v106, v108 };
                fun.drawBLine(dxf, Line27, 0.3, contour);
                Vector2[] Line28 = { v108, v109 };
                fun.drawBLine(dxf, Line28, 0.3, contour);
                Vector2[] Line29 = { v109, v111 };
                fun.drawBLine(dxf, Line29, 0.3, contour);
                Vector2[] Line30 = { v111, v114 };
                fun.drawBLine(dxf, Line30, 0.3, contour);
                Vector2[] Line31 = { v114, v116 };
                fun.drawBLine(dxf, Line31, 0.3, contour);
                Vector2[] Line34 = { v116, v101 };
                fun.drawBLine(dxf, Line34, 0.3, contour);
                Vector2[] Line35 = { v102, v113 };
                fun.drawBLine(dxf, Line35, 0.3, contour);
                Vector2[] Line36 = { v103, v118 };
                fun.drawBLine(dxf, Line36, 0.3, contour);
                Vector2[] Line37 = { v104, v117 };
                fun.drawBLine(dxf, Line37, 0.3, contour);
                Vector2[] Line38 = { v107, v112 };
                fun.drawBLine(dxf, Line38, 0.3, contour);
                Vector2[] Line39 = { v117, v118 };
                fun.drawBLine(dxf, Line39, 0.3, contour);
                Line Line32 = new Line(v116, v115);
                Line32.Layer = dimensioning;
                dxf.AddEntity(Line32);
                Line Line33 = new Line(v109, v110);
                Line33.Layer = dimensioning;
                dxf.AddEntity(Line33);
                LwPolyline Arc10 = new LwPolyline();
                Arc10.Vertexes.Add(new LwPolylineVertex(v121));
                Arc10.Vertexes.Add(new LwPolylineVertex(v120));
                Arc10.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc10, 0, refin, Linetype.Dashed);
                LwPolyline Arc11 = new LwPolyline();
                Arc11.Vertexes.Add(new LwPolylineVertex(v120));
                Arc11.Vertexes.Add(new LwPolylineVertex(v121));
                Arc11.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc11, 0, refin, Linetype.Dashed);
                //文本样式

                double offset = 10;

                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v1, v27), 2 * offset + (v27.Y - v1.Y), 180, dimensionStyle);
                dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v5, v9),- offset - (v5.Y - v9.Y)/2, 0, dimensionStyle);
                dim2.UserText = "LF="+ Math.Round(lf / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v3, v27), offset + v3.Y - v2.Y, 180, dimensionStyle);
                dim3.UserText = "LS="+ Math.Round(ls / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v1, v2), offset + (v2.Y - v1.Y), 180, dimensionStyle);
                dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(v3, v4), ls+ offset, 270, dimensionStyle);
                dim5.UserText = "DCON="+ Math.Round(dcon / scale, 2);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(v108, v101), 4 * offset + (v101.X + v108.X) / 2 - v101.X, 90, dimensionStyle);
                dim6.UserText = "OAH="+ Math.Round(oah / scale, 2);
                dxf.AddEntity(dim6);

                LinearDimension dim7 = new LinearDimension(new Line(v114, v119), offset + v114.X - (v119.X + v114.X) / 2, 270, dimensionStyle);
                dim7.UserText = "RHCDU="+ Math.Round(rhcdu / scale, 2);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(v119, v111), offset + v111.X - (v119.X + v111.X) / 2, 270, dimensionStyle);
                dim8.UserText = "RHCDL="+ Math.Round(rhcdl / scale, 2);
                dxf.AddEntity(dim8);

                LinearDimension dim9 = new LinearDimension(new Line(v119, v109), 2 * offset + (v119.X + v109.X) / 2 - v108.X, 90, dimensionStyle);
                dim9.UserText = "RADH="+ Math.Round(radh / scale, 2);
                dxf.AddEntity(dim9);

                LinearDimension dim10 = new LinearDimension(new Line(v108, v111), 2 * offset + v108.Y - (v108.Y + v111.Y) / 2, 0, dimensionStyle);
                dim10.UserText = "OAW="+ Math.Round(oaw / scale, 2);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v119, v106), offset + (v106.Y + v119.Y) / 2 - v116.Y, 180, dimensionStyle);
                dim11.UserText = "RADW="+ Math.Round(radw / scale, 2);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(v106, v101), offset + (v106.Y + v101.Y) / 2 - v101.Y, 180, dimensionStyle);
                dim12.UserText = "RADWOF="+ Math.Round(radwof / scale, 2);
                dxf.AddEntity(dim12);

                LinearDimension dim13 = new LinearDimension(new Line(v119, v106), offset + (v106.X + v119.X) / 2 - v106.X, 90, dimensionStyle2);
                dim13.UserText = "RADHOF="+ Math.Round(radhof / scale, 2);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v119, v107), 2 * offset + (v119.X + v107.X) / 2 - v107.X, 90, dimensionStyle);
                dim14.UserText = "HF="+ Math.Round(hf / scale, 2);
                dxf.AddEntity(dim14);

                Angular2LineDimension dim15 = new Angular2LineDimension(new Line(v109, v110), new Line(v109, v111), 4 * offset, dimensionStyle2);
                dim15.UserText = String.Format("RHCAU={0}°", rhcau / (pi / 180));
                dxf.AddEntity(dim15);

                Angular2LineDimension dim16 = new Angular2LineDimension(new Line(v116, v114), new Line(v116, v115), 2 * offset, dimensionStyle2);
                dim16.UserText = String.Format("RHCAL={0}°", rhcal / (pi / 180));
                dxf.AddEntity(dim16);

                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2((-210 + lpr) / 2, 148.5 + oah / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }
            if (style == "b5")
            {   //坐标b1
                Vector2 v1 = new Vector2(0, oah);//工件侧
                Vector2 v2 = new Vector2(lpr, v1.Y);
                Vector2 v3 = new Vector2(v2.X, radh + dcon / 2);
                Vector2 v4 = new Vector2(v3.X, v3.Y - dcon);
                Vector2 v5 = new Vector2(v4.X, v3.Y - dcon / 2 - h8);
                Vector2 v6 = new Vector2(v2.X - v5.Y / Math.Tan(a), 0);
                Vector2 v7 = new Vector2(0, 0);
                Vector2 v8 = new Vector2(0, v3.Y - dcon / 2 - hf);
                Vector2 v9 = new Vector2(lpr - lf, v8.Y);
                Vector2 v10 = new Vector2(v9.X, v9.Y + h2);
                Vector2 v11 = new Vector2(0, v10.Y);
                Vector2 v12 = new Vector2(v11.X + 2, v11.Y - 2);
                Vector2 v13 = new Vector2(v10.X - 2, v10.Y - 2);
                Vector2 v14 = new Vector2(v13.X, v3.Y - dcon / 2 + 2);
                Vector2 v15 = new Vector2(v12.X, v14.Y);
                Vector2 v16 = new Vector2(v3.X + ll7, v3.Y);
                Vector2 v17 = new Vector2(v16.X, v16.Y - (dcon - hh2));
                Vector2 v18 = new Vector2(v3.X + ll2 - ll3 / 2, v17.Y);
                Vector2 v19 = new Vector2(v18.X + (jtjl - 2 * jtgd) / 2, v18.Y);
                Vector2 v20 = new Vector2(v19.X + jtgd - Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2, v19.Y - jtgd + Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2);
                Vector2 v21 = new Vector2(v20.X + Math.Sqrt(yjbj * yjbj + yjbj * yjbj), v20.Y);
                Vector2 v22 = new Vector2(v19.X + 2 * jtgd, v19.Y);
                Vector2 v23 = new Vector2(v22.X + (jtjl - 2 * jtgd) / 2, v19.Y);
                Vector2 v24 = new Vector2(v18.X + ll3, v19.Y);
                Vector2 v25 = new Vector2(v3.X + ls - ll4, v19.Y);
                Vector2 v26 = new Vector2(v3.X + ls, v19.Y);
                Vector2 v27 = new Vector2(v26.X, v26.Y - hh2);
                Vector2 v28 = new Vector2(v25.X, v25.Y - hh2);
                double l = Math.Sqrt(yjbj * yjbj + yjbj * yjbj);
                double h = yjbj - (Math.Sqrt((yjbj * yjbj) - l * l / 4));
                Vector2 v101 = new Vector2(oal*2, 0);
                Vector2 v102 = new Vector2(oal*2, radh - rhcdl);
                Vector2 v103 = new Vector2(oal*2, radh - hf);
                Vector2 v104 = new Vector2(oal*2, v103.Y + h2);
                Vector2 v105 = new Vector2(oal*2, rhcdu + radh);
                Vector2 v106 = new Vector2(oal*2, oah);
                Vector2 v107 = new Vector2(oal*2 + (oah - v105.Y) / Math.Tan(rhcau), v106.Y);
                Vector2 v108 = new Vector2(oal*2 + oaw - radwof, v107.Y);
                Vector2 v109 = new Vector2(v108.X, v104.Y);
                Vector2 v110 = new Vector2(v109.X, v109.Y - 2);
                Vector2 v111 = new Vector2(v110.X, v14.Y);
                Vector2 v112 = new Vector2(v111.X, radh - radhof);
                Vector2 v113 = new Vector2(v112.X + radwof, v112.Y);
                Vector2 v114 = new Vector2(v113.X, v103.Y);
                Vector2 v115 = new Vector2(v114.X, 0);
                Vector2 v116 = new Vector2(oal*2 + v102.Y / Math.Tan(rhcal), 0);
                Vector2 v117 = new Vector2(oal*2 + oaw - radw, radh);
                Vector2 v118 = new Vector2(v104.X + 2, v104.Y - 2);
                Vector2 v119 = new Vector2(v118.X, v111.Y);
                Vector2 v120 = new Vector2(v117.X, v117.Y + dcon / 2);
                Vector2 v121 = new Vector2(v117.X + dcon / 2, v117.Y);
                Vector2 v122 = new Vector2(v117.X, v117.Y - dcon / 2);
                Vector2 v123 = new Vector2(v117.X - dcon / 2, v117.Y);
                Vector2 v124 = new Vector2(lpr - lf + 2, radh - radhof);
                Vector2 v125 = new Vector2(v124.X, 0);
                Vector2 v126 = new Vector2(lpr - lf + 2 + radwof / Math.Tan(bb), v1.Y);
                Vector2 v127 = new Vector2(v126.X, v124.Y);
                Vector2 v128 = new Vector2(lpr - lf, v127.Y);

                //线段
                Vector2[] Line1 = { v1, v2 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v2, v5 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v5, v6 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v6, v7 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v7, v8 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                Vector2[] Line6 = { v8, v9 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v9, v10 };
                fun.drawBLine(dxf, Line7, 0.3, contour);
                Vector2[] Line8 = { v10, v11 };
                fun.drawBLine(dxf, Line8, 0.3, contour);
                Vector2[] Line9 = { v11, v1 };
                fun.drawBLine(dxf, Line9, 0.3, contour);
                Vector2[] Line10 = { v12, v13 };
                fun.drawBLine(dxf, Line10, 0.3, contour);
                Vector2[] Line11 = { v13, v14 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Vector2[] Line12 = { v14, v15 };
                fun.drawBLine(dxf, Line12, 0.3, contour);
                Vector2[] Line13 = { v15, v12 };
                fun.drawBLine(dxf, Line13, 0.3, contour);
                Vector2[] Line14 = { v3, v16 };
                fun.drawBLine(dxf, Line14, 0.3, contour);
                Vector2[] Line15 = { v16, v17 };
                fun.drawBLine(dxf, Line15, 0.3, contour);
                Vector2[] Line16 = { v17, v18 };
                fun.drawBLine(dxf, Line16, 0.3, contour);
                Vector2[] Line17 = { v18, v19 };
                fun.drawBLine(dxf, Line17, 0.3, contour);
                Vector2[] Line18 = { v19, v20 };
                fun.drawBLine(dxf, Line18, 0.3, contour);
                Vector2[] Line19 = { v21, v22 };
                fun.drawBLine(dxf, Line19, 0.3, contour);
                Vector2[] Line20 = { v22, v23 };
                fun.drawBLine(dxf, Line20, 0.3, contour);
                Vector2[] Line21 = { v24, v26 };
                fun.drawBLine(dxf, Line21, 0.3, contour);
                Vector2[] Line22 = { v25, v28 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                Vector2[] Line23 = { v26, v27 };
                fun.drawBLine(dxf, Line23, 0.3, contour);
                Vector2[] Line24 = { v27, v4 };
                fun.drawBLine(dxf, Line24, 0.3, contour);
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v20));
                Arc1.Vertexes.Add(new LwPolylineVertex(v21));
                Arc1.Vertexes[0].Bulge = 2 * h / l;
                fun.PolyFill(dxf, Arc1, 0.3, contour);
                Line line1 = new Line(v18, v19);
                line1.Layer = contour;
                Line[] linepoarray1 = new Line[1000];
                linepoarray1 = fun.arrayrline(line1, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray1[i] });
                }
                ;
                Line line2 = new Line(v19, v20);
                line2.Layer = contour;
                Line[] linepoarray2 = new Line[1000];
                linepoarray2 = fun.arrayrline(line2, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray2[i] });
                }
                ;
                Line line3 = new Line(v21, v22);
                line3.Layer = contour;
                Line[] linepoarray3 = new Line[1000];
                linepoarray3 = fun.arrayrline(line3, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray3[i] });
                }
                ;
                Line line4 = new Line(v22, v23);
                line4.Layer = contour;
                Line[] linepoarray4 = new Line[1000];
                linepoarray4 = fun.arrayrline(line4, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray4[i] });
                }
                ;
                Arc arc5 = new Arc(new Vector2((v20.X + v21.X) / 2, v20.Y + yjbj - h), yjbj, -135, -45);
                arc5.Layer = contour;
                Arc[] linepoarray5 = new Arc[1000];
                linepoarray5 = fun.arrayrarc(arc5, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray5[i] });
                }
                ;
                Vector2[] Line25 = { v102, v105 };
                fun.drawBLine(dxf, Line25, 0.3, contour);
                Vector2[] Line26 = { v105, v107 };
                fun.drawBLine(dxf, Line26, 0.3, contour);
                Vector2[] Line27 = { v107, v108 };
                fun.drawBLine(dxf, Line27, 0.3, contour);
                Vector2[] Line28 = { v108, v112 };
                fun.drawBLine(dxf, Line28, 0.3, contour);
                Vector2[] Line29 = { v112, v113 };
                fun.drawBLine(dxf, Line29, 0.3, contour);
                Vector2[] Line30 = { v113, v115 };
                fun.drawBLine(dxf, Line30, 0.3, contour);
                Vector2[] Line31 = { v115, v116 };
                fun.drawBLine(dxf, Line31, 0.3, contour);
                Vector2[] Line34 = { v116, v102 };
                fun.drawBLine(dxf, Line34, 0.3, contour);
                Vector2[] Line35 = { v103, v114 };
                fun.drawBLine(dxf, Line35, 0.3, contour);
                Vector2[] Line36 = { v118, v110 };
                fun.drawBLine(dxf, Line36, 0.3, contour);
                Vector2[] Line37 = { v119, v111 };
                fun.drawBLine(dxf, Line37, 0.3, contour);
                Vector2[] Line38 = { v104, v109 };
                fun.drawBLine(dxf, Line38, 0.3, contour);
                Vector2[] Line39 = { v118, v119 };
                fun.drawBLine(dxf, Line39, 0.3, contour);
                Line Line32 = new Line(v116, v101);
                Line32.Layer = dimensioning;
                dxf.AddEntity(Line32);
                Line Line33 = new Line(v107, v106);
                Line33.Layer = dimensioning;
                dxf.AddEntity(Line33);
                Vector2[] Line40 = { v124, v125 };
                fun.drawBLine(dxf, Line40, 0.3, contour);
                Vector2[] Line41 = { v126, v127 };
                fun.drawBLine(dxf, Line41, 0.3, contour);
                Vector2[] Line42 = { v127, v128 };
                fun.drawBLine(dxf, Line42, 0.3, contour);
                LwPolyline Arc10 = new LwPolyline();
                Arc10.Vertexes.Add(new LwPolylineVertex(v121));
                Arc10.Vertexes.Add(new LwPolylineVertex(v123));
                Arc10.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc10, 0, refin, Linetype.Dashed);
                LwPolyline Arc11 = new LwPolyline();
                Arc11.Vertexes.Add(new LwPolylineVertex(v123));
                Arc11.Vertexes.Add(new LwPolylineVertex(v121));
                Arc11.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc11, 0, refin, Linetype.Dashed);
                //文本样式

                double offset = 10;

                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v1, v26), 3 * offset + (v1.Y - v26.Y), 0, dimensionStyle);
                dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v2, v10), offset + (v2.Y - v10.Y), 0, dimensionStyle);
                dim2.UserText = "LF="+ Math.Round(lf / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v4, v27), offset, 180, dimensionStyle);
                dim3.UserText = "LS="+ Math.Round(ls / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v5, v7),offset + (v5.Y - v7.Y)/2, 180, dimensionStyle);
                dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(v3, v4),ls+ offset, 270, dimensionStyle);
                dim5.UserText = "DCON="+ Math.Round(dcon / scale, 2);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(v107, v116), 4 * offset + (v107.X + v116.X) / 2 - v101.X, 90, dimensionStyle);
                dim6.UserText = "OAH="+ Math.Round(oah / scale, 2);
                dxf.AddEntity(dim6);

                LinearDimension dim7 = new LinearDimension(new Line(v105, v117), offset + (v117.X + v105.X) / 2 - v105.X, 90, dimensionStyle);
                dim7.UserText = "RHCDU="+ Math.Round(rhcdu / scale, 2);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(v117, v102), offset + (v117.X + v102.X) / 2 - v102.X, 90, dimensionStyle);
                dim8.UserText = "RHCDL="+ Math.Round(rhcdl / scale, 2);
                dxf.AddEntity(dim8);

                LinearDimension dim9 = new LinearDimension(new Line(v117, v116), 2 * offset + (v116.X + v117.X) / 2 - v105.X, 90, dimensionStyle);
                dim9.UserText = "RADH="+ Math.Round(radh / scale, 2);
                dxf.AddEntity(dim9);

                LinearDimension dim10 = new LinearDimension(new Line(v115, v102), 2 * offset + (v115.Y + v102.Y) / 2 - v115.Y, 180, dimensionStyle);
                dim10.UserText = "OAW="+ Math.Round(oaw / scale, 2);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v117, v115), offset + (v115.Y + v117.Y) / 2 - v115.Y, 180, dimensionStyle);
                dim11.UserText = "RADW="+ Math.Round(radw / scale, 2);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(v108, v113), offset + v108.Y - (v108.Y + v113.Y) / 2, 0, dimensionStyle);
                dim12.UserText = "RADWOF="+ Math.Round(radwof / scale, 2);
                dxf.AddEntity(dim12);

                LinearDimension dim13 = new LinearDimension(new Line(v117, v113), offset + v113.X - (v117.X + v113.X) / 2, 270, dimensionStyle2);
                dim13.UserText = "RADHOF="+ Math.Round(radhof / scale, 2);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v117, v114), 2 * offset + v114.X - (v117.X + v114.X) / 2, 270, dimensionStyle);
                dim14.UserText = "HF="+ Math.Round(hf / scale, 2);
                dxf.AddEntity(dim14);

                Angular2LineDimension dim15 = new Angular2LineDimension(new Line(v107, v106), new Line(v107, v105), 2 * offset, dimensionStyle2);
                dim15.UserText = String.Format("RHCAU={0}°", rhcau / (pi / 180));
                dxf.AddEntity(dim15);

                Angular2LineDimension dim16 = new Angular2LineDimension(new Line(v116, v102), new Line(v116, v101), 2 * offset, dimensionStyle2);
                dim16.UserText = String.Format("RHCAL={0}°", rhcal / (pi / 180));
                dxf.AddEntity(dim16);

                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2((-210 + lpr) / 2, 148.5 + oah / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }
            if (style == "b6")
            {   //坐标b2
                Vector2 v1 = new Vector2(0, oah);//工件侧
                Vector2 v2 = new Vector2(lpr, v1.Y);
                Vector2 v3 = new Vector2(v2.X, radh + dcon / 2);
                Vector2 v4 = new Vector2(v3.X, v3.Y - dcon);
                Vector2 v5 = new Vector2(v4.X, v3.Y - dcon / 2 - h8);
                Vector2 v6 = new Vector2(v2.X - v5.Y / Math.Tan(a), 0);
                Vector2 v7 = new Vector2(0, 0);
                Vector2 v8 = new Vector2(0, v3.Y - dcon / 2 - hf);
                Vector2 v9 = new Vector2(lpr - lf, v8.Y);
                Vector2 v10 = new Vector2(v9.X, v9.Y + h2);
                Vector2 v11 = new Vector2(0, v10.Y);
                Vector2 v12 = new Vector2(v11.X + 2, v11.Y - 2);
                Vector2 v13 = new Vector2(v10.X - 2, v10.Y - 2);
                Vector2 v14 = new Vector2(v13.X, v3.Y - dcon / 2 + 2);
                Vector2 v15 = new Vector2(v12.X, v14.Y);
                Vector2 v16 = new Vector2(v3.X + ll7, v3.Y);
                Vector2 v17 = new Vector2(v16.X, v16.Y - (dcon - hh2));
                Vector2 v18 = new Vector2(v3.X + ll2 - ll3 / 2, v17.Y);
                Vector2 v19 = new Vector2(v18.X + (jtjl - 2 * jtgd) / 2, v18.Y);
                Vector2 v20 = new Vector2(v19.X + jtgd - Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2, v19.Y - jtgd + Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2);
                Vector2 v21 = new Vector2(v20.X + Math.Sqrt(yjbj * yjbj + yjbj * yjbj), v20.Y);
                Vector2 v22 = new Vector2(v19.X + 2 * jtgd, v19.Y);
                Vector2 v23 = new Vector2(v22.X + (jtjl - 2 * jtgd) / 2, v19.Y);
                Vector2 v24 = new Vector2(v18.X + ll3, v19.Y);
                Vector2 v25 = new Vector2(v3.X + ls - ll4, v19.Y);
                Vector2 v26 = new Vector2(v3.X + ls, v19.Y);
                Vector2 v27 = new Vector2(v26.X, v26.Y - hh2);
                Vector2 v28 = new Vector2(v25.X, v25.Y - hh2);
                double l = Math.Sqrt(yjbj * yjbj + yjbj * yjbj);
                double h = yjbj - (Math.Sqrt((yjbj * yjbj) - l * l / 4));
                Vector2 v101 = new Vector2(oal*2, 0);
                Vector2 v102 = new Vector2(oal*2, radh - hf);
                Vector2 v103 = new Vector2(oal*2, radh - radhof);
                Vector2 v104 = new Vector2(oal*2 + radwof, v103.Y);
                Vector2 v105 = new Vector2(v104.X, radh + 2);
                Vector2 v107 = new Vector2(v105.X, v102.Y + h2);
                Vector2 v106 = new Vector2(v107.X, v107.Y - 2);
                Vector2 v108 = new Vector2(v106.X, oah);
                Vector2 v109 = new Vector2(oal*2 + oaw - (oah - rhcdu - radh) / Math.Tan(rhcau), v108.Y);
                Vector2 v110 = new Vector2(oal*2 + oaw, v109.Y);
                Vector2 v111 = new Vector2(v110.X, rhcdu + radh);
                Vector2 v112 = new Vector2(v111.X, v107.Y);
                Vector2 v113 = new Vector2(v112.X, v102.Y);
                Vector2 v114 = new Vector2(v113.X, radh - rhcdl);
                Vector2 v115 = new Vector2(oal*2 + oaw - (radh - rhcdl) / Math.Tan(rhcal), 0);
                Vector2 v116 = new Vector2(v112.X - 2, v106.Y);
                Vector2 v117 = new Vector2(v116.X, v105.Y);
                Vector2 v118 = new Vector2(oal*2 + radw, radh);
                Vector2 v119 = new Vector2(v118.X - dcon / 2, v118.Y);
                Vector2 v120 = new Vector2(v118.X + dcon / 2, v118.Y);
                Vector2 v121 = new Vector2(v114.X, 0);
                Vector2 v122 = new Vector2(v1.X, rhcdu + radh);
                Vector2 v123 = new Vector2(v2.X, v122.Y);
                Vector2 v124 = new Vector2(v1.X, radh - rhcdl);
                Vector2 v125 = new Vector2(v2.X, v124.Y);
                //线段
                Vector2[] Line1 = { v1, v2 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v2, v5 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v5, v6 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v6, v7 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v7, v8 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                Vector2[] Line6 = { v8, v9 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v9, v10 };
                fun.drawBLine(dxf, Line7, 0.3, contour);
                Vector2[] Line8 = { v10, v11 };
                fun.drawBLine(dxf, Line8, 0.3, contour);
                Vector2[] Line9 = { v11, v1 };
                fun.drawBLine(dxf, Line9, 0.3, contour);
                Vector2[] Line10 = { v12, v13 };
                fun.drawBLine(dxf, Line10, 0.3, contour);
                Vector2[] Line11 = { v13, v14 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Vector2[] Line12 = { v14, v15 };
                fun.drawBLine(dxf, Line12, 0.3, contour);
                Vector2[] Line13 = { v15, v12 };
                fun.drawBLine(dxf, Line13, 0.3, contour);
                Vector2[] Line14 = { v3, v16 };
                fun.drawBLine(dxf, Line14, 0.3, contour);
                Vector2[] Line15 = { v16, v17 };
                fun.drawBLine(dxf, Line15, 0.3, contour);
                Vector2[] Line16 = { v17, v18 };
                fun.drawBLine(dxf, Line16, 0.3, contour);
                Vector2[] Line17 = { v18, v19 };
                fun.drawBLine(dxf, Line17, 0.3, contour);
                Vector2[] Line18 = { v19, v20 };
                fun.drawBLine(dxf, Line18, 0.3, contour);
                Vector2[] Line19 = { v21, v22 };
                fun.drawBLine(dxf, Line19, 0.3, contour);
                Vector2[] Line20 = { v22, v23 };
                fun.drawBLine(dxf, Line20, 0.3, contour);
                Vector2[] Line21 = { v24, v26 };
                fun.drawBLine(dxf, Line21, 0.3, contour);
                Vector2[] Line22 = { v25, v28 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                Vector2[] Line23 = { v26, v27 };
                fun.drawBLine(dxf, Line23, 0.3, contour);
                Vector2[] Line24 = { v27, v4 };
                fun.drawBLine(dxf, Line24, 0.3, contour);
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v20));
                Arc1.Vertexes.Add(new LwPolylineVertex(v21));
                Arc1.Vertexes[0].Bulge = 2 * h / l;
                fun.PolyFill(dxf, Arc1, 0.3, contour);
                Line line1 = new Line(v18, v19);
                line1.Layer = contour;
                Line[] linepoarray1 = new Line[1000];
                linepoarray1 = fun.arrayrline(line1, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray1[i] });
                }
                ;
                Line line2 = new Line(v19, v20);
                line2.Layer = contour;
                Line[] linepoarray2 = new Line[1000];
                linepoarray2 = fun.arrayrline(line2, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray2[i] });
                }
                ;
                Line line3 = new Line(v21, v22);
                line3.Layer = contour;
                Line[] linepoarray3 = new Line[1000];
                linepoarray3 = fun.arrayrline(line3, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray3[i] });
                }
                ;
                Line line4 = new Line(v22, v23);
                line4.Layer = contour;
                Line[] linepoarray4 = new Line[1000];
                linepoarray4 = fun.arrayrline(line4, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray4[i] });
                }
                ;
                Arc arc5 = new Arc(new Vector2((v20.X + v21.X) / 2, v20.Y + yjbj - h), yjbj, -135, -45);
                arc5.Layer = contour;
                Arc[] linepoarray5 = new Arc[1000];
                linepoarray5 = fun.arrayrarc(arc5, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray5[i] });
                }
                ;
                Vector2[] Line25 = { v101, v103 };
                fun.drawBLine(dxf, Line25, 0.3, contour);
                Vector2[] Line26 = { v103, v104 };
                fun.drawBLine(dxf, Line26, 0.3, contour);
                Vector2[] Line27 = { v104, v108 };
                fun.drawBLine(dxf, Line27, 0.3, contour);
                Vector2[] Line28 = { v108, v109 };
                fun.drawBLine(dxf, Line28, 0.3, contour);
                Vector2[] Line29 = { v109, v111 };
                fun.drawBLine(dxf, Line29, 0.3, contour);
                Vector2[] Line30 = { v111, v114 };
                fun.drawBLine(dxf, Line30, 0.3, contour);
                Vector2[] Line31 = { v114, v115 };
                fun.drawBLine(dxf, Line31, 0.3, contour);
                Vector2[] Line34 = { v115, v101 };
                fun.drawBLine(dxf, Line34, 0.3, contour);
                Vector2[] Line35 = { v102, v113 };
                fun.drawBLine(dxf, Line35, 0.3, contour);
                Vector2[] Line36 = { v105, v117 };
                fun.drawBLine(dxf, Line36, 0.3, contour);
                Vector2[] Line37 = { v106, v116 };
                fun.drawBLine(dxf, Line37, 0.3, contour);
                Vector2[] Line38 = { v107, v112 };
                fun.drawBLine(dxf, Line38, 0.3, contour);
                Line Line32 = new Line(v109, v110);
                Line32.Layer = dimensioning;
                dxf.AddEntity(Line32);
                Line Line33 = new Line(v115, v121);
                Line33.Layer = dimensioning;
                dxf.AddEntity(Line33);
                Vector2[] Line39 = { v122, v123 };
                fun.drawBLine(dxf, Line39, 0.3, contour);
                Vector2[] Line40 = { v124, v125 };
                fun.drawBLine(dxf, Line40, 0.3, contour);
                LwPolyline Arc10 = new LwPolyline();
                Arc10.Vertexes.Add(new LwPolylineVertex(v120));
                Arc10.Vertexes.Add(new LwPolylineVertex(v119));
                Arc10.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc10, 0, refin, Linetype.Dashed);
                LwPolyline Arc11 = new LwPolyline();
                Arc11.Vertexes.Add(new LwPolylineVertex(v119));
                Arc11.Vertexes.Add(new LwPolylineVertex(v120));
                Arc11.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc11, 0, refin, Linetype.Dashed);
                //文本样式
                double offset = 10;

                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v1, v26), 3 * offset + (v1.Y - v26.Y), 0, dimensionStyle);
                dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v2, v10), -offset -(v2.Y - v10.Y)/2, 0, dimensionStyle);
                dim2.UserText = "LF="+ Math.Round(lf / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v4, v27),offset, 180, dimensionStyle);
                dim3.UserText = "LS="+ Math.Round(ls / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v5, v7), offset + (v5.Y - v7.Y)/2, 180, dimensionStyle);
                dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(v3, v4),ls+ offset, 270, dimensionStyle);
                dim5.UserText = "DCON="+ Math.Round(dcon / scale, 2);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(v109, v115), 4 * offset + v111.X - (v109.X + v115.X) / 2, 90, dimensionStyle);
                dim6.UserText = "OAH="+ Math.Round(oah / scale, 2);
                dxf.AddEntity(dim6);

                LinearDimension dim7 = new LinearDimension(new Line(v111, v118), offset + v111.X - (v111.X + v118.X) / 2, 270, dimensionStyle);
                dim7.UserText = "RHCDU="+ Math.Round(rhcdu / scale, 2);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(v114, v118), offset + v114.X - (v114.X + v118.X) / 2, 270, dimensionStyle);
                dim8.UserText = "RHCDL="+ Math.Round(rhcdl / scale, 2);
                dxf.AddEntity(dim8);

                LinearDimension dim9 = new LinearDimension(new Line(v115, v118), 2 * offset + v114.X - (v115.X + v118.X) / 2, 270, dimensionStyle);
                dim9.UserText = "RADH="+ Math.Round(radh / scale, 2);
                dxf.AddEntity(dim9);

                LinearDimension dim10 = new LinearDimension(new Line(v114, v101), 2 * offset + (v101.Y + v114.Y) / 2 - v101.Y, 180, dimensionStyle);
                dim10.UserText = "OAW="+ Math.Round(oaw / scale, 2);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v118, v101), offset + (v118.Y + v101.Y) / 2 - v101.Y, 180, dimensionStyle);
                dim11.UserText = "RADW="+ Math.Round(radw / scale, 2);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(v103, v108), offset + v108.Y - (v103.Y + v108.Y) / 2, 0, dimensionStyle);
                dim12.UserText = "RADWOF="+ Math.Round(radwof / scale, 2);
                dxf.AddEntity(dim12);

                LinearDimension dim13 = new LinearDimension(new Line(v118, v103), offset + (v118.X + v103.X) / 2 - v103.X, 90, dimensionStyle2);
                dim13.UserText = "RADHOF="+ Math.Round(radhof / scale, 2);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v118, v102), 2 * offset + (v118.X + v102.X) / 2 - v102.X, 90, dimensionStyle);
                dim14.UserText = "HF="+ Math.Round(hf / scale, 2);
                dxf.AddEntity(dim14);

                Angular2LineDimension dim15 = new Angular2LineDimension(new Line(v109, v110), new Line(v109, v111), 2 * offset, dimensionStyle2);
                dim15.UserText = String.Format("RHCAU={0}°", rhcau / (pi / 180));
                dxf.AddEntity(dim15);

                Angular2LineDimension dim16 = new Angular2LineDimension(new Line(v115, v114), new Line(v115, v121), 2 * offset, dimensionStyle2);
                dim16.UserText = String.Format("RHCAL={0}°", rhcal / (pi / 180));
                dxf.AddEntity(dim16);

                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2((-210 + lpr) / 2, 148.5 + oah / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }
            if (style == "b7")
            {   //坐标b1
                Vector2 v1 = new Vector2(0, 0);//工件侧
                Vector2 v2 = new Vector2(lpr, v1.Y);
                Vector2 v3 = new Vector2(v2.X, h7 - dcon / 2);
                Vector2 v4 = new Vector2(v3.X, v3.Y + dcon);
                Vector2 v5 = new Vector2(v4.X, h7 + h9);
                Vector2 v6 = new Vector2(v2.X - (oah - v5.Y) / Math.Tan(a), oah);
                Vector2 v7 = new Vector2(0, v6.Y);
                Vector2 v8 = new Vector2(0, h7 + hf);
                Vector2 v9 = new Vector2(lpr - lf, v8.Y);
                Vector2 v10 = new Vector2(v9.X, v9.Y - h2);
                Vector2 v11 = new Vector2(0, v10.Y);
                Vector2 v12 = new Vector2(v11.X + 2, v11.Y + 2);
                Vector2 v13 = new Vector2(v10.X - 2, v12.Y);
                Vector2 v14 = new Vector2(v13.X, v3.Y + dcon / 2 - 2);
                Vector2 v15 = new Vector2(v12.X, v14.Y);

                Vector2 v16 = new Vector2(lpr + ll7, h7 + dcon / 2);
                Vector2 v17 = new Vector2(v16.X, v16.Y - (dcon - hh2));
                Vector2 v18 = new Vector2(lpr + ll2 - ll3 / 2, v17.Y);
                Vector2 v19 = new Vector2(v18.X + (jtjl - 2 * jtgd) / 2, v18.Y);
                Vector2 v20 = new Vector2(v19.X + jtgd - Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2, v19.Y - jtgd + Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2);
                Vector2 v21 = new Vector2(v20.X + Math.Sqrt(yjbj * yjbj + yjbj * yjbj), v20.Y);
                Vector2 v22 = new Vector2(v19.X + 2 * jtgd, v19.Y);
                Vector2 v23 = new Vector2(v22.X + (jtjl - 2 * jtgd) / 2, v19.Y);
                Vector2 v24 = new Vector2(v18.X + ll3, v19.Y);
                Vector2 v25 = new Vector2(lpr + ls - ll4, v19.Y);
                Vector2 v26 = new Vector2(lpr + ls, v19.Y);
                Vector2 v27 = new Vector2(v26.X, v26.Y - hh2);
                Vector2 v28 = new Vector2(v25.X, v25.Y - hh2);
                double l = Math.Sqrt(yjbj * yjbj + yjbj * yjbj);
                double h = yjbj - (Math.Sqrt((yjbj * yjbj) - l * l / 4));

                Vector2 v101 = new Vector2(oal*2, 0);
                Vector2 v102 = new Vector2(oal*2, oah - radh - rhcdl);
                Vector2 v104 = new Vector2(oal*2, h7 + hf);
                Vector2 v103 = new Vector2(oal*2, h7 + hf - h2);
                Vector2 v105 = new Vector2(oal*2, h7 + rhcdl);
                Vector2 v106 = new Vector2(oal*2, oah);
                Vector2 v107 = new Vector2(oal*2 + (oah - v105.Y) / Math.Tan(rhcal), v106.Y);
                Vector2 v108 = new Vector2(oal*2 + oaw, v107.Y);
                Vector2 v109 = new Vector2(v108.X, v104.Y);
                Vector2 v110 = new Vector2(v109.X, oah - radh + radhof);
                Vector2 v111 = new Vector2(v110.X - radwof, v110.Y);
                Vector2 v112 = new Vector2(v111.X, oah - radh - 2);
                Vector2 v114 = new Vector2(v112.X, v103.Y);
                Vector2 v113 = new Vector2(v114.X, v114.Y + 2);
                Vector2 v115 = new Vector2(v114.X, 0);
                Vector2 v116 = new Vector2(oal*2 + v102.Y / Math.Tan(rhcau), 0);
                Vector2 v117 = new Vector2(v103.X + 2, v112.Y);
                Vector2 v118 = new Vector2(v117.X, v113.Y);
                Vector2 v119 = new Vector2(oal*2 + oaw - radw, h7);
                Vector2 v120 = new Vector2(v119.X - dcon / 2, v119.Y);
                Vector2 v121 = new Vector2(v119.X + dcon / 2, v119.Y);
                Vector2 v122 = new Vector2(v9.X + 2, v7.Y);
                Vector2 v123 = new Vector2(v122.X, v111.Y);
                Vector2 v124 = new Vector2(v9.X, v111.Y);
                Vector2 v125 = new Vector2(v9.X + 2 + radwof / Math.Tan(bb), v111.Y);
                Vector2 v126 = new Vector2(v125.X, 0);

                //线段
                Vector2[] Line1 = { v1, v2 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v2, v5 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v5, v6 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v6, v7 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v7, v8 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                Vector2[] Line6 = { v8, v9 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v9, v10 };
                fun.drawBLine(dxf, Line7, 0.3, contour);
                Vector2[] Line8 = { v10, v11 };
                fun.drawBLine(dxf, Line8, 0.3, contour);
                Vector2[] Line9 = { v11, v1 };
                fun.drawBLine(dxf, Line9, 0.3, contour);
                Vector2[] Line10 = { v12, v13 };
                fun.drawBLine(dxf, Line10, 0.3, contour);
                Vector2[] Line11 = { v13, v14 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Vector2[] Line12 = { v14, v15 };
                fun.drawBLine(dxf, Line12, 0.3, contour);
                Vector2[] Line13 = { v15, v12 };
                fun.drawBLine(dxf, Line13, 0.3, contour);
                Vector2[] Line14 = { v4, v16 };
                fun.drawBLine(dxf, Line14, 0.3, contour);
                Vector2[] Line15 = { v16, v17 };
                fun.drawBLine(dxf, Line15, 0.3, contour);
                Vector2[] Line16 = { v17, v18 };
                fun.drawBLine(dxf, Line16, 0.3, contour);
                Vector2[] Line17 = { v18, v19 };
                fun.drawBLine(dxf, Line17, 0.3, contour);
                Vector2[] Line18 = { v19, v20 };
                fun.drawBLine(dxf, Line18, 0.3, contour);
                Vector2[] Line19 = { v21, v22 };
                fun.drawBLine(dxf, Line19, 0.3, contour);
                Vector2[] Line20 = { v22, v23 };
                fun.drawBLine(dxf, Line20, 0.3, contour);
                Vector2[] Line21 = { v24, v26 };
                fun.drawBLine(dxf, Line21, 0.3, contour);
                Vector2[] Line22 = { v25, v28 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                Vector2[] Line23 = { v26, v27 };
                fun.drawBLine(dxf, Line23, 0.3, contour);
                Vector2[] Line24 = { v27, v3 };
                fun.drawBLine(dxf, Line24, 0.3, contour);
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v20));
                Arc1.Vertexes.Add(new LwPolylineVertex(v21));
                Arc1.Vertexes[0].Bulge = 2 * h / l;
                fun.PolyFill(dxf, Arc1, 0.3, contour);
                Line line1 = new Line(v18, v19);
                line1.Layer = contour;
                Line[] linepoarray1 = new Line[1000];
                linepoarray1 = fun.arrayrline(line1, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray1[i] });
                }
                ;
                Line line2 = new Line(v19, v20);
                line2.Layer = contour;
                Line[] linepoarray2 = new Line[1000];
                linepoarray2 = fun.arrayrline(line2, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray2[i] });
                }
                ;
                Line line3 = new Line(v21, v22);
                line3.Layer = contour;
                Line[] linepoarray3 = new Line[1000];
                linepoarray3 = fun.arrayrline(line3, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray3[i] });
                }
                ;
                Line line4 = new Line(v22, v23);
                line4.Layer = contour;
                Line[] linepoarray4 = new Line[1000];
                linepoarray4 = fun.arrayrline(line4, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray4[i] });
                }
                ;
                Arc arc5 = new Arc(new Vector2((v20.X + v21.X) / 2, v20.Y + yjbj - h), yjbj, -135, -45);
                arc5.Layer = contour;
                Arc[] linepoarray5 = new Arc[1000];
                linepoarray5 = fun.arrayrarc(arc5, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray5[i] });
                }
                ;
                Vector2[] Line25 = { v102, v105 };
                fun.drawBLine(dxf, Line25, 0.3, contour);
                Vector2[] Line26 = { v105, v107 };
                fun.drawBLine(dxf, Line26, 0.3, contour);
                Vector2[] Line27 = { v107, v108 };
                fun.drawBLine(dxf, Line27, 0.3, contour);
                Vector2[] Line28 = { v108, v110 };
                fun.drawBLine(dxf, Line28, 0.3, contour);
                Vector2[] Line29 = { v110, v111 };
                fun.drawBLine(dxf, Line29, 0.3, contour);
                Vector2[] Line30 = { v111, v115 };
                fun.drawBLine(dxf, Line30, 0.3, contour);
                Vector2[] Line31 = { v115, v116 };
                fun.drawBLine(dxf, Line31, 0.3, contour);
                Vector2[] Line34 = { v116, v102 };
                fun.drawBLine(dxf, Line34, 0.3, contour);
                Vector2[] Line35 = { v103, v114 };
                fun.drawBLine(dxf, Line35, 0.3, contour);
                Vector2[] Line36 = { v118, v113 };
                fun.drawBLine(dxf, Line36, 0.3, contour);
                Vector2[] Line37 = { v117, v112 };
                fun.drawBLine(dxf, Line37, 0.3, contour);
                Vector2[] Line38 = { v104, v109 };
                fun.drawBLine(dxf, Line38, 0.3, contour);
                Vector2[] Line39 = { v117, v118 };
                fun.drawBLine(dxf, Line39, 0.3, contour);
                Vector2[] Line40 = { v122, v123 };
                fun.drawBLine(dxf, Line40, 0.3, contour);
                Vector2[] Line41 = { v124, v125 };
                fun.drawBLine(dxf, Line41, 0.3, contour);
                Vector2[] Line42 = { v125, v126 };
                fun.drawBLine(dxf, Line42, 0.3, contour);
                Line Line32 = new Line(v116, v101);
                Line32.Layer = dimensioning;
                dxf.AddEntity(Line32);
                Line Line33 = new Line(v107, v106);
                Line33.Layer = dimensioning;
                dxf.AddEntity(Line33);
                LwPolyline Arc10 = new LwPolyline();
                Arc10.Vertexes.Add(new LwPolylineVertex(v121));
                Arc10.Vertexes.Add(new LwPolylineVertex(v120));
                Arc10.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc10, 0, refin, Linetype.Dashed);
                LwPolyline Arc11 = new LwPolyline();
                Arc11.Vertexes.Add(new LwPolylineVertex(v120));
                Arc11.Vertexes.Add(new LwPolylineVertex(v121));
                Arc11.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc11, 0, refin, Linetype.Dashed);
                //文本样式
                double offset = 10;

                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v1, v27), 2 * offset + (v27.Y - v1.Y), 180, dimensionStyle);
                dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v5, v9), offset + (v5.Y - v9.Y), 0, dimensionStyle);
                dim2.SetDimensionLinePosition(new Vector2(0,v107.Y+offset));
                dim2.UserText = "LF="+ Math.Round(lf / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v3, v27), offset + v3.Y - v2.Y, 180, dimensionStyle);
                dim3.UserText = "LS="+ Math.Round(ls / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v1, v2), offset + (v2.Y - v1.Y), 180, dimensionStyle);
                dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(v3, v4), 7 * offset, 270, dimensionStyle);
                dim5.UserText = "DCON="+ Math.Round(dcon / scale, 2);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(v107, v116), 4 * offset + (v107.X + v116.X) / 2 - v101.X, 90, dimensionStyle);
                dim6.UserText = "OAH="+ Math.Round(oah / scale, 2);
                dxf.AddEntity(dim6);

                LinearDimension dim7 = new LinearDimension(new Line(v102, v119), offset + (v119.X + v102.X) / 2 - v102.X, 90, dimensionStyle);
                dim7.UserText = "RHCDU="+ Math.Round(rhcdu / scale, 2);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(v119, v105), offset + (v119.X + v105.X) / 2 - v105.X, 90, dimensionStyle);
                dim8.UserText = "RHCDL="+ Math.Round(rhcdl / scale, 2);
                dxf.AddEntity(dim8);

                LinearDimension dim9 = new LinearDimension(new Line(v119, v107), 2 * offset + (v119.X + v107.X) / 2 - v106.X, 90, dimensionStyle);
                dim9.UserText = "RADH="+ Math.Round(radh / scale, 2);
                dxf.AddEntity(dim9);

                LinearDimension dim10 = new LinearDimension(new Line(v115, v102), 2 * offset + (v115.Y + v102.Y) / 2 - v115.Y, 180, dimensionStyle);
                dim10.UserText = "OAW="+ Math.Round(oaw / scale, 2);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v119, v115), offset + (v115.Y + v119.Y) / 2 - v115.Y, 180, dimensionStyle);
                dim11.UserText = "RADW="+ Math.Round(radw / scale, 2);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(v115, v110), offset + (v110.Y + v115.Y) / 2 - v115.Y, 180, dimensionStyle);
                dim12.UserText = "RADWOF="+ Math.Round(radwof / scale, 2);
                dxf.AddEntity(dim12);

                LinearDimension dim13 = new LinearDimension(new Line(v119, v110), offset + v110.X - (v110.X + v119.X) / 2, 270, dimensionStyle2);
                dim13.UserText = "RADHOF="+ Math.Round(radhof / scale, 2);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v119, v109), 2 * offset + v109.X - (v119.X + v109.X) / 2, 270, dimensionStyle);
                dim14.UserText = "HF="+ Math.Round(hf / scale, 2);
                dxf.AddEntity(dim14);

                Angular2LineDimension dim15 = new Angular2LineDimension(new Line(v107, v106), new Line(v107, v105), 2 * offset, dimensionStyle2);
                dim15.UserText = String.Format("RHCAU={0}°", rhcau / (pi / 180));
                dxf.AddEntity(dim15);

                Angular2LineDimension dim16 = new Angular2LineDimension(new Line(v116, v102), new Line(v116, v101), 2 * offset, dimensionStyle2);
                dim16.UserText = String.Format("RHCAL={0}°", rhcal / (pi / 180));
                dxf.AddEntity(dim16);

                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2((-210 + lpr) / 2, 148.5 + oah / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }
            if (style == "b8")
            {   //坐标b1
                Vector2 v1 = new Vector2(0, 0);//工件侧
                Vector2 v2 = new Vector2(lpr, v1.Y);
                Vector2 v3 = new Vector2(v2.X, h7 - dcon / 2);
                Vector2 v4 = new Vector2(v3.X, v3.Y + dcon);
                Vector2 v5 = new Vector2(v4.X, h7 + h9);
                Vector2 v6 = new Vector2(v2.X - (oah - v5.Y) / Math.Tan(a), oah);
                Vector2 v7 = new Vector2(0, v6.Y);
                Vector2 v8 = new Vector2(0, h7 + hf);
                Vector2 v9 = new Vector2(lpr - lf, v8.Y);
                Vector2 v10 = new Vector2(v9.X, v9.Y - h2);
                Vector2 v11 = new Vector2(0, v10.Y);
                Vector2 v12 = new Vector2(v11.X + 2, v11.Y + 2);
                Vector2 v13 = new Vector2(v10.X - 2, v12.Y);
                Vector2 v14 = new Vector2(v13.X, v3.Y + dcon / 2 - 2);
                Vector2 v15 = new Vector2(v12.X, v14.Y);

                Vector2 v16 = new Vector2(lpr + ll7, h7 + dcon / 2);
                Vector2 v17 = new Vector2(v16.X, v16.Y - (dcon - hh2));
                Vector2 v18 = new Vector2(lpr + ll2 - ll3 / 2, v17.Y);
                Vector2 v19 = new Vector2(v18.X + (jtjl - 2 * jtgd) / 2, v18.Y);
                Vector2 v20 = new Vector2(v19.X + jtgd - Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2, v19.Y - jtgd + Math.Sqrt(yjbj * yjbj + yjbj * yjbj) / 2);
                Vector2 v21 = new Vector2(v20.X + Math.Sqrt(yjbj * yjbj + yjbj * yjbj), v20.Y);
                Vector2 v22 = new Vector2(v19.X + 2 * jtgd, v19.Y);
                Vector2 v23 = new Vector2(v22.X + (jtjl - 2 * jtgd) / 2, v19.Y);
                Vector2 v24 = new Vector2(v18.X + ll3, v19.Y);
                Vector2 v25 = new Vector2(lpr + ls - ll4, v19.Y);
                Vector2 v26 = new Vector2(lpr + ls, v19.Y);
                Vector2 v27 = new Vector2(v26.X, v26.Y - hh2);
                Vector2 v28 = new Vector2(v25.X, v25.Y - hh2);
                double l = Math.Sqrt(yjbj * yjbj + yjbj * yjbj);
                double h = yjbj - (Math.Sqrt((yjbj * yjbj) - l * l / 4));

                Vector2 v101 = new Vector2(oal*2 + radwof, 0);
                Vector2 v102 = new Vector2(v101.X, h7 + hf - h2);
                Vector2 v103 = new Vector2(v102.X, h7 + hf - h2 + 2);
                Vector2 v104 = new Vector2(v103.X, oah - radh - 2);
                Vector2 v105 = new Vector2(v104.X, oah - radh + radhof);
                Vector2 v106 = new Vector2(oal*2, oah - radh + radhof);
                Vector2 v107 = new Vector2(oal*2, h7 + hf);
                Vector2 v108 = new Vector2(oal*2, oah);
                Vector2 v109 = new Vector2(oal*2 + oaw - (oah - h7 - rhcdl) / Math.Tan(rhcal), v108.Y);
                Vector2 v110 = new Vector2(oal*2 + oaw, v109.Y);
                Vector2 v111 = new Vector2(v110.X, h7 + rhcdl);
                Vector2 v112 = new Vector2(v111.X, v107.Y);
                Vector2 v113 = new Vector2(v112.X, v102.Y);
                Vector2 v114 = new Vector2(v113.X, oah - radh - rhcdl);
                Vector2 v115 = new Vector2(v114.X, 0);
                Vector2 v116 = new Vector2(oal*2 + oaw - v114.Y / Math.Tan(rhcau), 0);
                Vector2 v117 = new Vector2(v113.X - 2, v104.Y);
                Vector2 v118 = new Vector2(v117.X, v103.Y);
                Vector2 v119 = new Vector2(oal*2 + radw, h7);
                Vector2 v120 = new Vector2(v119.X - dcon / 2, v119.Y);
                Vector2 v121 = new Vector2(v119.X + dcon / 2, v119.Y);
                Vector2 v122 = new Vector2(v7.X, v111.Y);
                Vector2 v123 = new Vector2(v5.X, v111.Y);
                //线段
                Vector2[] Line1 = { v1, v2 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v2, v5 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v5, v6 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v6, v7 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v7, v8 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                Vector2[] Line6 = { v8, v9 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v9, v10 };
                fun.drawBLine(dxf, Line7, 0.3, contour);
                Vector2[] Line8 = { v10, v11 };
                fun.drawBLine(dxf, Line8, 0.3, contour);
                Vector2[] Line9 = { v11, v1 };
                fun.drawBLine(dxf, Line9, 0.3, contour);
                Vector2[] Line10 = { v12, v13 };
                fun.drawBLine(dxf, Line10, 0.3, contour);
                Vector2[] Line11 = { v13, v14 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Vector2[] Line12 = { v14, v15 };
                fun.drawBLine(dxf, Line12, 0.3, contour);
                Vector2[] Line13 = { v15, v12 };
                fun.drawBLine(dxf, Line13, 0.3, contour);
                Vector2[] Line14 = { v4, v16 };
                fun.drawBLine(dxf, Line14, 0.3, contour);
                Vector2[] Line15 = { v16, v17 };
                fun.drawBLine(dxf, Line15, 0.3, contour);
                Vector2[] Line16 = { v17, v18 };
                fun.drawBLine(dxf, Line16, 0.3, contour);
                Vector2[] Line17 = { v18, v19 };
                fun.drawBLine(dxf, Line17, 0.3, contour);
                Vector2[] Line18 = { v19, v20 };
                fun.drawBLine(dxf, Line18, 0.3, contour);
                Vector2[] Line19 = { v21, v22 };
                fun.drawBLine(dxf, Line19, 0.3, contour);
                Vector2[] Line20 = { v22, v23 };
                fun.drawBLine(dxf, Line20, 0.3, contour);
                Vector2[] Line21 = { v24, v26 };
                fun.drawBLine(dxf, Line21, 0.3, contour);
                Vector2[] Line22 = { v25, v28 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                Vector2[] Line23 = { v26, v27 };
                fun.drawBLine(dxf, Line23, 0.3, contour);
                Vector2[] Line24 = { v27, v3 };
                fun.drawBLine(dxf, Line24, 0.3, contour);
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v20));
                Arc1.Vertexes.Add(new LwPolylineVertex(v21));
                Arc1.Vertexes[0].Bulge = 2 * h / l;
                fun.PolyFill(dxf, Arc1, 0.3, contour);
                Line line1 = new Line(v18, v19);
                line1.Layer = contour;
                Line[] linepoarray1 = new Line[1000];
                linepoarray1 = fun.arrayrline(line1, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray1[i] });
                }
                ;
                Line line2 = new Line(v19, v20);
                line2.Layer = contour;
                Line[] linepoarray2 = new Line[1000];
                linepoarray2 = fun.arrayrline(line2, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray2[i] });
                }
                ;
                Line line3 = new Line(v21, v22);
                line3.Layer = contour;
                Line[] linepoarray3 = new Line[1000];
                linepoarray3 = fun.arrayrline(line3, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray3[i] });
                }
                ;
                Line line4 = new Line(v22, v23);
                line4.Layer = contour;
                Line[] linepoarray4 = new Line[1000];
                linepoarray4 = fun.arrayrline(line4, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray4[i] });
                }
                ;
                Arc arc5 = new Arc(new Vector2((v20.X + v21.X) / 2, v20.Y + yjbj - h), yjbj, -135, -45);
                arc5.Layer = contour;
                Arc[] linepoarray5 = new Arc[1000];
                linepoarray5 = fun.arrayrarc(arc5, n1 + 1, 2, 4 * scale, 10);
                for (int i = 1; i <= n1; i++)
                {
                    dxf.AddEntity(new EntityObject[] { linepoarray5[i] });
                }
                ;
                Vector2[] Line25 = { v101, v105 };
                fun.drawBLine(dxf, Line25, 0.3, contour);
                Vector2[] Line26 = { v105, v106 };
                fun.drawBLine(dxf, Line26, 0.3, contour);
                Vector2[] Line27 = { v106, v108 };
                fun.drawBLine(dxf, Line27, 0.3, contour);
                Vector2[] Line28 = { v108, v109 };
                fun.drawBLine(dxf, Line28, 0.3, contour);
                Vector2[] Line29 = { v109, v111 };
                fun.drawBLine(dxf, Line29, 0.3, contour);
                Vector2[] Line30 = { v111, v114 };
                fun.drawBLine(dxf, Line30, 0.3, contour);
                Vector2[] Line31 = { v114, v116 };
                fun.drawBLine(dxf, Line31, 0.3, contour);
                Vector2[] Line34 = { v116, v101 };
                fun.drawBLine(dxf, Line34, 0.3, contour);
                Vector2[] Line35 = { v102, v113 };
                fun.drawBLine(dxf, Line35, 0.3, contour);
                Vector2[] Line36 = { v103, v118 };
                fun.drawBLine(dxf, Line36, 0.3, contour);
                Vector2[] Line37 = { v104, v117 };
                fun.drawBLine(dxf, Line37, 0.3, contour);
                Vector2[] Line38 = { v107, v112 };
                fun.drawBLine(dxf, Line38, 0.3, contour);
                Vector2[] Line39 = { v117, v118 };
                fun.drawBLine(dxf, Line39, 0.3, contour);
                Vector2[] Line40 = { v122, v123 };
                fun.drawBLine(dxf, Line40, 0.3, contour);
                Line Line32 = new Line(v116, v115);
                Line32.Layer = dimensioning;
                dxf.AddEntity(Line32);
                Line Line33 = new Line(v109, v110);
                Line33.Layer = dimensioning;
                dxf.AddEntity(Line33);
                LwPolyline Arc10 = new LwPolyline();
                Arc10.Vertexes.Add(new LwPolylineVertex(v121));
                Arc10.Vertexes.Add(new LwPolylineVertex(v120));
                Arc10.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc10, 0, refin, Linetype.Dashed);
                LwPolyline Arc11 = new LwPolyline();
                Arc11.Vertexes.Add(new LwPolylineVertex(v120));
                Arc11.Vertexes.Add(new LwPolylineVertex(v121));
                Arc11.Vertexes[0].Bulge = 2 * dcon / 2 / dcon;
                fun.PolyFillandlinetype(dxf, Arc11, 0, refin, Linetype.Dashed);
                //文本样式
                double offset = 10;

                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v1, v27), 2 * offset + (v27.Y - v1.Y), 180, dimensionStyle);
                dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v5, v9), offset + (v5.Y - v9.Y), 0, dimensionStyle);
                dim2.SetDimensionLinePosition(v4);
                dim2.UserText = "LF="+ Math.Round(lf / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v3, v27), offset + v3.Y - v2.Y, 180, dimensionStyle);
                dim3.UserText = "LS="+ Math.Round(ls / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v1, v2), offset + (v2.Y - v1.Y), 180, dimensionStyle);
                dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(v3, v4), 7 * offset, 270, dimensionStyle);
                dim5.SetDimensionLinePosition(new Vector2(v27.X+offset,v27.Y));
                dim5.UserText = "DCON="+ Math.Round(dcon / scale, 2);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(v108, v101), 4 * offset + (v101.X + v108.X) / 2 - v101.X, 90, dimensionStyle);
                dim6.UserText = "OAH="+ Math.Round(oah / scale, 2);
                dxf.AddEntity(dim6);

                LinearDimension dim7 = new LinearDimension(new Line(v114, v119), offset + v114.X - (v119.X + v114.X) / 2, 270, dimensionStyle);
                dim7.UserText = "RHCDU="+ Math.Round(rhcdu / scale, 2);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(v119, v111), offset + v111.X - (v119.X + v111.X) / 2, 270, dimensionStyle);
                dim8.UserText = "RHCDL="+ Math.Round(rhcdl / scale, 2);
                dxf.AddEntity(dim8);

                LinearDimension dim9 = new LinearDimension(new Line(v119, v109), 2 * offset + (v119.X + v109.X) / 2 - v108.X, 90, dimensionStyle);
                dim9.UserText = "RADH="+ Math.Round(radh / scale, 2);
                dxf.AddEntity(dim9);

                LinearDimension dim10 = new LinearDimension(new Line(v108, v111), 2 * offset + v108.Y - (v108.Y + v111.Y) / 2, 0, dimensionStyle);
                dim10.UserText = "OAW="+ Math.Round(oaw / scale, 2);
                dxf.AddEntity(dim10);

                LinearDimension dim11 = new LinearDimension(new Line(v119, v106), offset*2 + (v106.Y + v119.Y) / 2 - v116.Y, 180, dimensionStyle);
                dim11.UserText = "RADW="+ Math.Round(radw / scale, 2);
                dxf.AddEntity(dim11);

                LinearDimension dim12 = new LinearDimension(new Line(v106, v101), offset + (v106.Y + v101.Y) / 2 - v101.Y, 180, dimensionStyle);
                dim12.UserText = "RADWOF="+ Math.Round(radwof / scale, 2);
                dxf.AddEntity(dim12);

                LinearDimension dim13 = new LinearDimension(new Line(v119, v106), offset + (v106.X + v119.X) / 2 - v106.X, 90, dimensionStyle2);
                dim13.UserText = "RADHOF="+ Math.Round(radhof / scale, 2);
                dxf.AddEntity(dim13);

                LinearDimension dim14 = new LinearDimension(new Line(v119, v107), 2 * offset + (v119.X + v107.X) / 2 - v107.X, 90, dimensionStyle);
                dim14.UserText = "HF="+ Math.Round(hf / scale, 2);
                dxf.AddEntity(dim14);

                Angular2LineDimension dim15 = new Angular2LineDimension(new Line(v109, v110), new Line(v109, v111), 4 * offset, dimensionStyle2);
                dim15.UserText = String.Format("RHCAU={0}°", rhcau / (pi / 180));
                dxf.AddEntity(dim15);

                Angular2LineDimension dim16 = new Angular2LineDimension(new Line(v116, v114), new Line(v116, v115), 2 * offset, dimensionStyle2);
                dim16.UserText = String.Format("RHCAL={0}°", rhcal / (pi / 180));
                dxf.AddEntity(dim16);

                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2((-210 + lpr) / 2, 148.5 + oah / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            fun.SetLayer(dxf); fun.SetByLayer(dxf);

            //文件格式
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);

        }
        public static void Extender(Dictionary<string, Object> data)    //延长器
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour") { Color = AciColor.Cyan };    //轮廓层
            Layer dimensioning = new Layer("dimensioning");    //尺寸层
            Layer refin = new Layer("refin") { Color = AciColor.Red };    //基准线/内轮廓
            Layer centre = new Layer("centre") { Color = AciColor.Yellow };    //中心线
            Layer textlayer = new Layer("textlayer") { Color = AciColor.Blue };    //文本层
            Layer hatching = new Layer("hatching") { Color = AciColor.Blue };    //填充层
            Layer additionalline = new Layer("additionalline") { Color = AciColor.Cyan };    //附加线
            Layer cutting = new Layer("cutting") { Color = AciColor.Red };    //切削层
            Layer nocutting = new Layer("nocutting");    //非切削层
            Layer skcontour = new Layer("skcontour") { Color = AciColor.Cyan };    //sk轮廓层
            Layer skdimensioning = new Layer("skdimensioning");    //sk尺寸线层
            Layer skrefin = new Layer("skrefin") { Color = AciColor.Red };    //sk基准线/内轮廓
            Layer sktext = new Layer("sktext") { Color = AciColor.Blue };  //sk文本
            Layer skhatching = new Layer("skhatching") { Color = AciColor.Blue };    //sk填充
            Layer skadditionlline = new Layer("skadditionlline") { Color = AciColor.Cyan };    //sk附加线
            Layer skviewcontour = new Layer("skviewcontour") { Color = AciColor.Cyan };    //skview轮廓
            Layer skviewdimensioning = new Layer("skviewdimensioning");    //skview尺寸线层
            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double soal = Convert.ToDouble(data["oal"]);//总长度
            double scale = Convert.ToDouble(data["scale"]);//比例
            if (scale == 0)
            {
                if (soal < 53.8)
                {
                    scale = 5.0;
                }
                else if (soal < 67.25)
                {
                    scale = 4.0;
                }
                else if (soal < 90)
                {
                    scale = 3.0;
                }
                else if (soal < 134.5)
                {
                    scale = 2.0;
                }
                else if (soal < 269)
                {
                    scale = 1.0;
                }
                else if (soal < 359)
                {
                    scale = 0.75;
                }
                else
                {
                    scale = 0.5;
                }
            }//比例判断
            double l2 = Convert.ToDouble(data["l2"]) * scale;
            double lb = 3 * l2;//体长
            double l1 = Convert.ToDouble(data["l1"]) * scale;
            double l3 = Convert.ToDouble(data["l3"]) * scale;
            double lpcon = Convert.ToDouble(data["lpcon"]) * scale;//连接伸出长度
            double lf = lpcon + lb;//功能长度
            double lpr = lf;//伸出长度
            double oal = Convert.ToDouble(data["oal"]) * scale;//总长度
            double dconms = Convert.ToDouble(data["dconms"]) * scale;//机床侧侧连接直径
            double dconws = Convert.ToDouble(data["dconws"]) * scale;//工件侧连接直径
            string ccms1 = Convert.ToString(data["ccms1"]);
            double czc1 = Convert.ToDouble(data["czc1"]);
            string ccms2 = Convert.ToString(data["ccms2"]);
            double czc2 = Convert.ToDouble(data["czc2"]);
            double l4 = Convert.ToDouble(data["l4"]) * scale;
            double l6 = Convert.ToDouble(data["l6"]) * scale;
            double D = Convert.ToDouble(data["d"]) * scale;
            double aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
            double bb = Convert.ToDouble(data["bb"]) * pi / 180;
            double isframe = Convert.ToDouble(data["isframe"]);


            DimensionStyle dimensionStyle = fun.DimStyle(true);


            if (ccms1 == "ccs01")//PSC
            {
                if (czc1 == 32)
                {
                    l1 = 2.5 * scale;
                    l2 = 19 * scale;
                    l3 = 15 * scale;
                    l4 = 1 * scale;
                    l6 = 6 * scale;
                    D = 22 * scale;
                    dconms = 32 * scale;
                    dconws = 32 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
                if (czc1 == 40)
                {
                    l1 = 2.5 * scale;
                    l2 = 24 * scale;
                    l3 = 20 * scale;
                    l4 = 1.5 * scale;
                    l6 = 8 * scale;
                    D = 28 * scale;
                    dconms = 40 * scale;
                    dconws = 40 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
                if (czc1 == 50)
                {
                    l1 = 3 * scale;
                    l2 = 30 * scale;
                    l3 = 20 * scale;
                    l4 = 1.5 * scale;
                    l6 = 10 * scale;
                    D = 35 * scale;
                    dconms = 50 * scale;
                    dconws = 50 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
                if (czc1 == 63)
                {
                    l1 = 3 * scale;
                    l2 = 38 * scale;
                    l3 = 22 * scale;
                    l4 = 1.5 * scale;
                    l6 = 12 * scale;
                    D = 44 * scale;
                    dconms = 63 * scale;
                    dconws = 63 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
                if (czc1 == 80)
                {
                    l1 = 3 * scale;
                    l2 = 48 * scale;
                    l3 = 30 * scale;
                    l4 = 1.5 * scale;
                    l6 = 12 * scale;
                    D = 55 * scale;
                    dconms = 80 * scale;
                    dconws = 80 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
                if (czc1 > 80)
                {
                    l1 = 3 * scale;
                    l2 = 48 * scale;
                    l3 = 32 * scale;
                    l4 = 1.5 * scale;
                    l6 = 16 * scale;
                    D = 55 * scale;
                    dconms = 100 * scale;
                    dconws = 100 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
            }
            if (ccms2 == "ccs01")//工件侧形状
            {
                if (czc2 == 32)
                {
                    l1 = 2.5 * scale;
                    l2 = 19 * scale;
                    l3 = 15 * scale;
                    l4 = 1 * scale;
                    l6 = 6 * scale;
                    D = 22 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
                if (czc2 == 40)
                {
                    l1 = 2.5 * scale;
                    l2 = 24 * scale;
                    l3 = 20 * scale;
                    l4 = 1.5 * scale;
                    l6 = 8 * scale;
                    D = 28 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
                if (czc2 == 50)
                {
                    l1 = 3 * scale;
                    l2 = 30 * scale;
                    l3 = 20 * scale;
                    l4 = 1.5 * scale;
                    l6 = 10 * scale;
                    D = 35 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
                if (czc2 == 63)
                {
                    l1 = 3 * scale;
                    l2 = 38 * scale;
                    l3 = 22 * scale;
                    l4 = 1.5 * scale;
                    l6 = 12 * scale;
                    D = 44 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
                if (czc2 == 80)
                {
                    l1 = 3 * scale;
                    l2 = 48 * scale;
                    l3 = 30 * scale;
                    l4 = 1.5 * scale;
                    l6 = 12 * scale;
                    D = 55 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
                if (czc2 > 80)
                {
                    l1 = 3 * scale;
                    l2 = 48 * scale;
                    l3 = 32 * scale;
                    l4 = 1.5 * scale;
                    l6 = 16 * scale;
                    D = 55 * scale;
                    aa = (1 + 26 / 60 + 21 / 3600) * pi / 180;
                    lpcon = (l1 + l3);
                    bb = 60 * pi / 180;
                }
            }
            //判断锥柄skg
            if (ccms1 == "ccs01")
            {
                //坐标
                Vector2 v2 = new Vector2(-l2 + l4, D / 2);//机床侧
                Vector2 v1 = new Vector2(-l2, D / 2 - l4 / Math.Tan(bb));
                Vector2 v3 = new Vector2(0, v2.Y + (l2 - l1) * Math.Tan(aa));
                Vector2 v4 = new Vector2(l1, v3.Y);
                Vector2 v9 = new Vector2(v4.X, -v4.Y);
                Vector2 v10 = new Vector2(v3.X, -v3.Y);
                Vector2 v11 = new Vector2(v2.X, -v2.Y);
                Vector2 v12 = new Vector2(v1.X, -v1.Y);
                //线段
                Vector2[] Line1 = { v1, v2 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v2, v3 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v3, v4 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v4, v9 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v9, v10 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                Vector2[] Line6 = { v10, v11 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v11, v12 };
                fun.drawBLine(dxf, Line7, 0.3, contour);
                Vector2[] Line8 = { v12, v1 };
                fun.drawBLine(dxf, Line8, 0.3, contour);

                //坐标
                Vector2 v5 = new Vector2(l1, dconms / 2);//法兰外侧
                Vector2 v6 = new Vector2(lpcon, dconms / 2);
                Vector2 v7 = new Vector2(v6.X, -v6.Y);
                Vector2 v8 = new Vector2(v5.X, -v5.Y);
                Vector2 v13 = new Vector2(lpcon + lb, dconws / 2);
                Vector2 v14 = new Vector2(v13.X, -v13.Y);
                //线段
                Vector2[] Line9 = { v5, v13 };
                fun.drawBLine(dxf, Line9, 0.3, contour);
                Vector2[] Line10 = { v13, v14 };
                fun.drawBLine(dxf, Line10, 0.3, contour);
                Vector2[] Line11 = { v14, v8 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Vector2[] Line12 = { v8, v5 };
                fun.drawBLine(dxf, Line12, 0.3, contour);
                Vector2[] Line13 = { v6, v7 };
                fun.drawBLine(dxf, Line13, 0.3, contour);
                Vector2[] Line14 = { v2, v11 };
                fun.drawBLine(dxf, Line14, 0.3, contour);
                Vector2[] Line15 = { v3, v10 };
                fun.drawBLine(dxf, Line15, 0.3, contour);
                //文本样式

                double offset = 10;
                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v12, v14), 2 * offset + (v12.Y + v14.Y) / 2 - v14.Y, 180, dimensionStyle);
                dim1.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v5, v13), offset, 0, dimensionStyle);
                dim2.UserText = "LF="+ Math.Round(lf / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v7, v8), offset, 180, dimensionStyle);
                dim3.UserText = "LPCON="+ Math.Round(lpcon / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v7, v14), offset, 180, dimensionStyle);
                dim4.UserText = "LB="+ Math.Round(lb / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim5 = new LinearDimension(new Line(v5, v8), 5 * offset, 90, dimensionStyle);
                dim5.UserText = "DCONMS="+ Math.Round(dconms / scale, 2);
                dxf.AddEntity(dim5);

                LinearDimension dim6 = new LinearDimension(new Line(v13, v14), offset, 270, dimensionStyle);
                dim6.UserText = "DCONWS="+ Math.Round(dconws / scale, 2);
                dxf.AddEntity(dim6);
            }
            //工件侧
            if (ccms2 == "ccs01")
            {
                //坐标
                Vector2 v15 = new Vector2(lpcon + lb - l2, D / 2);
                Vector2 v16 = new Vector2(lpcon + lb, v15.Y + (l2 - l1) * Math.Tan(aa));
                Vector2 v17 = new Vector2(v16.X, -v16.Y);
                Vector2 v18 = new Vector2(v15.X, -v15.Y);

                Vector2[] Line16 = { v15, v16 };
                fun.drawPlinetype(dxf, Line16, 0.15, refin, Linetype.Dashed);
                Vector2[] Line17 = { v17, v18 };
                fun.drawPlinetype(dxf, Line17, 0.15, refin, Linetype.Dashed);
                Vector2[] Line18 = { v18, v15 };
                fun.drawPlinetype(dxf, Line18, 0.15, refin, Linetype.Dashed);



                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-l1 + oal / 2 - 210, dconms / 2 + 148.5 - dconms / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }
            fun.SetLayer(dxf); fun.SetByLayer(dxf);

            //文件格式
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void ReducerPrimaryDesign(Dictionary<string, Object> data)    //变径器
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);

            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double soal = Convert.ToDouble(data["lpcon"]) + Convert.ToDouble(data["l1"]) * 7;//总长度
            double scale = Convert.ToDouble(data["scale"]);//比例
            if (scale == 0)
            {
                if (soal < 61)
                {
                    scale = 5.0;
                }
                else if (soal < 76)
                {
                    scale = 4.0;
                }
                else if (soal < 101)
                {
                    scale = 3.0;
                }
                else if (soal < 151)
                {
                    scale = 2.0;
                }
                else if (soal < 301)
                {
                    scale = 1.0;
                }
                else if (soal < 401)
                {
                    scale = 0.75;
                }
                else
                {
                    scale = 0.5;
                }
            }//比例判断
            double l1 = Convert.ToDouble(data["l1"]) * scale;
            double l3 = Convert.ToDouble(data["l3"]) * scale;
            double l5 = Convert.ToDouble(data["l5"]) * scale;
            double l19 = Convert.ToDouble(data["l19"]) * scale;
            double lb_1 = 3 * l1;//主体长1
            double lb_2 = 3 * l1;//主体长2
            double bd_1 = Convert.ToDouble(data["bd1"]) * scale;//主体直径1
            double bd_2 = Convert.ToDouble(data["bd2"]) * scale;//主体直径1
            double lpcon = Convert.ToDouble(data["lpcon"]) * scale;//连接伸出长度
            double lf = lpcon + lb_1 + lb_2;//功能长度
            double oal = lf + l1;//总长度
            double dcon = Convert.ToDouble(data["dcon"]) * scale;//机床侧侧连接直径
            double d2 = Convert.ToDouble(data["d2"]) * scale;//机床侧侧连接直径
            double d4 = Convert.ToDouble(data["d4"]) * scale;
            double d11 = Convert.ToDouble(data["d11"]) * scale;
            double bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
            double bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
            double bb3 = Convert.ToDouble(data["bb3"]) * pi / 180;
            double bb4 = Convert.ToDouble(data["bb4"]) * pi / 180;
            string ccms1 = Convert.ToString(data["ccms1"]);
            double czc1 = Convert.ToDouble(data["czc1"]);
            string ccms2 = Convert.ToString(data["ccms2"]);
            double czc2 = Convert.ToDouble(data["czc2"]);

            double isframe = Convert.ToDouble(data["isframe"]);

            DimensionStyle dimensionStyle = fun.DimStyle(true);


            if (ccms1 == "hsk")//PSC
            {
                if (czc1 == 32)
                {
                    l1 = 20 * scale;
                    lpcon = 10 * scale;
                    l3 = 5 * scale;
                    l5 = 0.75 * scale;
                    l19 = 2.25 * scale;
                    dcon = 32 * scale;
                    d2 = 23.9975 * scale;
                    bd_2 = 28.96 * scale;
                    d4 = 36.45 * scale;
                    d11 = 3.5 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
                if (czc1 == 40)
                {
                    l1 = 25 * scale;
                    lpcon = 12 * scale;
                    l3 = 6 * scale;
                    l5 = 1 * scale;
                    l19 = 2.25 * scale;
                    dcon = 40 * scale;
                    d2 = 29.9975 * scale;
                    bd_2 = 36.96 * scale;
                    d4 = 44.45 * scale;
                    d11 = 3.5 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
                if (czc1 == 50)
                {
                    l1 = 32 * scale;
                    lpcon = 18 * scale;
                    l3 = 9 * scale;
                    l5 = 1.5 * scale;
                    l19 = 3.75 * scale;
                    dcon = 50 * scale;
                    d2 = 39.9975 * scale;
                    bd_2 = 42.7 * scale;
                    d4 = 59.4 * scale;
                    d11 = 7 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
                if (czc1 == 63)
                {
                    l1 = 40 * scale;
                    lpcon = 20 * scale;
                    l3 = 10 * scale;
                    l5 = 1.5 * scale;
                    l19 = 3.75 * scale;
                    dcon = 63 * scale;
                    d2 = 49.9975 * scale;
                    bd_2 = 55.7 * scale;
                    d4 = 72.4 * scale;
                    d11 = 7 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
                if (czc1 == 80)
                {
                    l1 = 45 * scale;
                    lpcon = 22 * scale;
                    l3 = 11 * scale;
                    l5 = 1.5 * scale;
                    l19 = 3.75 * scale;
                    dcon = 80 * scale;
                    d2 = 63.9975 * scale;
                    bd_2 = 72.7 * scale;
                    d4 = 89.4 * scale;
                    d11 = 7 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
                if (czc1 == 100)
                {
                    l1 = 50 * scale;
                    lpcon = 22 * scale;
                    l3 = 11 * scale;
                    l5 = 1.5 * scale;
                    l19 = 3.75 * scale;
                    dcon = 100 * scale;
                    d2 = 81.9975 * scale;
                    bd_2 = 92.7 * scale;
                    d4 = 109.4 * scale;
                    d11 = 7 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
            }
            if (ccms2 == "hsk")//工件侧形状
            {
                if (czc2 == 32)
                {
                    l1 = 20 * scale;
                    lpcon = 10 * scale;
                    l3 = 5 * scale;
                    l5 = 0.75 * scale;
                    l19 = 2.25 * scale;
                    dcon = 32 * scale;
                    d2 = 23.9975 * scale;
                    bd_2 = 28.96 * scale;
                    d4 = 36.45 * scale;
                    d11 = 3.5 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
                if (czc2 == 40)
                {
                    l1 = 25 * scale;
                    lpcon = 12 * scale;
                    l3 = 6 * scale;
                    l5 = 1 * scale;
                    l19 = 2.25 * scale;
                    dcon = 40 * scale;
                    d2 = 29.9975 * scale;
                    bd_2 = 36.96 * scale;
                    d4 = 44.45 * scale;
                    d11 = 3.5 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
                if (czc2 == 50)
                {
                    l1 = 32 * scale;
                    lpcon = 18 * scale;
                    l3 = 9 * scale;
                    l5 = 1.5 * scale;
                    l19 = 3.75 * scale;
                    dcon = 50 * scale;
                    d2 = 39.9975 * scale;
                    bd_2 = 42.7 * scale;
                    d4 = 59.4 * scale;
                    d11 = 7 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
                if (czc2 == 63)
                {
                    l1 = 40 * scale;
                    lpcon = 20 * scale;
                    l3 = 10 * scale;
                    l5 = 1.5 * scale;
                    l19 = 3.75 * scale;
                    dcon = 63 * scale;
                    d2 = 49.9975 * scale;
                    bd_2 = 55.7 * scale;
                    d4 = 72.4 * scale;
                    d11 = 7 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
                if (czc2 == 80)
                {
                    l1 = 45 * scale;
                    lpcon = 22 * scale;
                    l3 = 11 * scale;
                    l5 = 1.5 * scale;
                    l19 = 3.75 * scale;
                    dcon = 80 * scale;
                    d2 = 63.9975 * scale;
                    bd_2 = 72.7 * scale;
                    d4 = 89.4 * scale;
                    d11 = 7 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
                if (czc2 == 100)
                {
                    l1 = 50 * scale;
                    lpcon = 22 * scale;
                    l3 = 11 * scale;
                    l5 = 1.5 * scale;
                    l19 = 3.75 * scale;
                    dcon = 100 * scale;
                    d2 = 81.9975 * scale;
                    bd_2 = 92.7 * scale;
                    d4 = 109.4 * scale;
                    d11 = 7 * scale;
                    bb1 = (5 + 46 / 60 + 29 / 3600) * pi / 180;
                    bb2 = (5 + 43 / 60 + 29 / 3600) * pi / 180;
                    bb3 = 60 * pi / 180;
                    bb4 = 60 * pi / 180;
                }
            }
            //判断锥柄
            if (ccms1 == "hsk")
            {
                //坐标锥柄
                Vector2 v2 = new Vector2(-l1 + l5, (d2 - 2 * l1 * Math.Tan(bb1 / 2)) / 2);//机床侧
                Vector2 v1 = new Vector2(-l1, v2.Y - l5 / Math.Tan(bb3));
                Vector2 v3 = new Vector2(0, d2 / 2);
                Vector2 v16 = new Vector2(v3.X, -v3.Y);
                Vector2 v17 = new Vector2(v2.X, -v2.Y);
                Vector2 v18 = new Vector2(v1.X, -v1.Y);
                //线段
                Vector2[] Line1 = { v1, v2 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v2, v3 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v3, v16 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v16, v17 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v17, v18 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                Vector2[] Line6 = { v18, v1 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v2, v17 };
                fun.drawBLine(dxf, Line7, 0.3, contour);

                //坐标法兰
                double y = d4 / 2 - dcon / 2 - d11 / 2;
                double x = Math.Sqrt((d11 / 2) * (d11 / 2) - y * y);
                double x1 = x - l19 / 2;
                double y1 = x1 / Math.Tan(bb4 / 2);
                Vector2 v4 = new Vector2(0, dcon / 2);
                Vector2 v5 = new Vector2(v4.X + (lpcon - 2 * x) / 2, v4.Y);
                Vector2 v6 = new Vector2(v5.X + x1, v5.Y - y1);
                Vector2 v7 = new Vector2(v6.X + 2 * x, v6.Y);
                Vector2 v8 = new Vector2(v7.X + x1, v5.Y);
                Vector2 v9 = new Vector2(v8.X + (lpcon - 2 * x) / 2, v8.Y);
                Vector2 v10 = new Vector2(v9.X, -v9.Y);
                Vector2 v11 = new Vector2(v8.X, -v8.Y);
                Vector2 v12 = new Vector2(v7.X, -v7.Y);
                Vector2 v13 = new Vector2(v6.X, -v6.Y);
                Vector2 v14 = new Vector2(v5.X, -v5.Y);
                Vector2 v15 = new Vector2(v4.X, -v4.Y);

                //线段
                Vector2[] Line9 = { v4, v5 };
                fun.drawBLine(dxf, Line9, 0.3, contour);
                Vector2[] Line10 = { v5, v6 };
                fun.drawBLine(dxf, Line10, 0.3, contour);
                Vector2[] Line11 = { v6, v7 };
                fun.drawBLine(dxf, Line11, 0.3, contour);
                Vector2[] Line12 = { v7, v8 };
                fun.drawBLine(dxf, Line12, 0.3, contour);
                Vector2[] Line13 = { v8, v9 };
                fun.drawBLine(dxf, Line13, 0.3, contour);
                Vector2[] Line14 = { v9, v10 };
                fun.drawBLine(dxf, Line14, 0.3, contour);
                Vector2[] Line15 = { v10, v11 };
                fun.drawBLine(dxf, Line15, 0.3, contour);
                Vector2[] Line16 = { v11, v12 };
                fun.drawBLine(dxf, Line16, 0.3, contour);
                Vector2[] Line17 = { v12, v13 };
                fun.drawBLine(dxf, Line17, 0.3, contour);
                Vector2[] Line18 = { v13, v14 };
                fun.drawBLine(dxf, Line18, 0.3, contour);
                Vector2[] Line19 = { v14, v15 };
                fun.drawBLine(dxf, Line19, 0.3, contour);
                Vector2[] Line20 = { v15, v4 };
                fun.drawBLine(dxf, Line20, 0.3, contour);

                //坐标主体
                Vector2 v19 = new Vector2(v9.X, bd_2 / 2);
                Vector2 v20 = new Vector2(v19.X + lb_2, bd_2 / 2);
                Vector2 v21 = new Vector2(v20.X + lpcon / 2, bd_1 / 2);
                Vector2 v22 = new Vector2(v21.X + lb_1, bd_1 / 2);
                Vector2 v23 = new Vector2(v22.X, -v22.Y);
                Vector2 v24 = new Vector2(v21.X, -v21.Y);
                Vector2 v25 = new Vector2(v20.X, -v20.Y);
                Vector2 v26 = new Vector2(v19.X, -v19.Y);

                //线段
                Vector2[] Line21 = { v19, v20 };
                fun.drawBLine(dxf, Line21, 0.3, contour);
                Vector2[] Line22 = { v20, v21 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                Vector2[] Line23 = { v21, v22 };
                fun.drawBLine(dxf, Line23, 0.3, contour);
                Vector2[] Line24 = { v22, v23 };
                fun.drawBLine(dxf, Line24, 0.3, contour);
                Vector2[] Line25 = { v23, v24 };
                fun.drawBLine(dxf, Line25, 0.3, contour);
                Vector2[] Line26 = { v24, v25 };
                fun.drawBLine(dxf, Line26, 0.3, contour);
                Vector2[] Line27 = { v25, v26 };
                fun.drawBLine(dxf, Line27, 0.3, contour);
                Vector2[] Line28 = { v26, v19 };
                fun.drawBLine(dxf, Line28, 0.3, contour);
                Vector2[] Line29 = { v20, v25 };
                fun.drawBLine(dxf, Line29, 0.3, contour);
                Vector2[] Line30 = { v21, v24 };
                fun.drawBLine(dxf, Line30, 0.3, contour);
                Vector2[] Line31 = { v5, v14 };
                fun.drawBLine(dxf, Line31, 0.3, contour);
                Vector2[] Line32 = { v6, v13 };
                fun.drawBLine(dxf, Line32, 0.3, contour);
                Vector2[] Line33 = { v7, v12 };
                fun.drawBLine(dxf, Line33, 0.3, contour);
                Vector2[] Line34 = { v8, v11 };
                fun.drawBLine(dxf, Line34, 0.3, contour);

                //文本样式
                double offset = 10;
                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v4, v9), offset, 0, dimensionStyle);
                dim1.SetDimensionLinePosition(new Vector2(0,v21.Y+offset));
                dim1.UserText = "LPCON="+ Math.Round(lpcon / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v4, v15), 5 * offset, 90, dimensionStyle);
                dim2.SetDimensionLinePosition(new Vector2(v18.X-offset,0));
                dim2.UserText = "DCON="+ Math.Round(dcon / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v18, v23), 2 * offset + (v18.Y -v23.Y) / 2  , 180, dimensionStyle);
                dim3.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v15, v23), offset + (v15.Y -v23.Y) / 2  , 180, dimensionStyle);
                dim4.UserText = "LF="+ Math.Round(lf / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim6 = new LinearDimension(new Line(v9, v21), offset, 0, dimensionStyle);
                dim6.SetDimensionLinePosition(new Vector2(0, v21.Y + offset));
                dim6.UserText = "LB_2="+ Math.Round(lb_2 / scale, 2);
                dxf.AddEntity(dim6);

                LinearDimension dim7 = new LinearDimension(new Line(v21, v22), offset, 0, dimensionStyle);
                dim7.UserText = "LB_1="+ Math.Round(lb_1 / scale, 2);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(v22, v23), offset, 270, dimensionStyle);
                dim8.UserText = "BD_1="+ Math.Round(bd_1 / scale, 2);
                dxf.AddEntity(dim8);

                LinearDimension dim9 = new LinearDimension(new Line(v20, v25), - offset, 270, dimensionStyle);
                dim9.UserText = "BD_2="+ Math.Round(bd_2 / scale, 2);
                dxf.AddEntity(dim9);
            }
            //工件侧
            if (ccms2 == "hsk")
            {
                //坐标
                double y = d4 / 2 - dcon / 2 - d11 / 2;
                double x = Math.Sqrt((d11 / 2) * (d11 / 2) - y * y);
                double x1 = x - l19 / 2;
                double y1 = x1 / Math.Tan(bb4 / 2);
                Vector2 v27 = new Vector2(lb_2 + lb_1 - l1 + 1.5 * lpcon, (d2 - 2 * l1 * Math.Tan(bb1)) / 2);
                Vector2 v28 = new Vector2((lpcon - 2 * x) / 2 + x1 + 2 * x + x1 + (lpcon - 2 * x) / 2 + lb_2 + lpcon / 2 + lb_1, d2 / 2);
                Vector2 v29 = new Vector2(v28.X, -v28.Y);
                Vector2 v30 = new Vector2(v27.X, -v27.Y);

                //线段
                Vector2[] Line16 = { v27, v28 };
                fun.drawPlinetype(dxf, Line16, 0.15, refin, Linetype.Dashed);
                Vector2[] Line17 = { v29, v30 };
                fun.drawPlinetype(dxf, Line17, 0.15, refin, Linetype.Dashed);
                Vector2[] Line18 = { v30, v27 };
                fun.drawPlinetype(dxf, Line18, 0.15, refin, Linetype.Dashed);

                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-l1 + oal / 2 - 210, dcon / 2 + 148.5 - dcon / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            fun.SetLayer(dxf); fun.SetByLayer(dxf);

            //文件格式
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
        public static void ReducerReverseDesign(Dictionary<string, Object> data)    //变径器逆向
        {
            DxfDocument dxf = new DxfDocument();
            //图层
            Layer contour = new Layer("contour");//轮廓层
            Layer dimensioning = new Layer("dimensioning");//尺寸层
            Layer refin = new Layer("refin");//基准线/内轮廓/虚线
            Layer center = new Layer("center");//中心线
            Layer textlayer = new Layer("textlayer");//文本层
            Layer hatching = new Layer("hatching");//填充层
            Layer additionalline = new Layer("additionalline");//附加线
            Layer cutting = new Layer("cutting");//切削层
            fun.SetLayer(dxf);

            //参数
            double pi = Math.PI;
            string path = Convert.ToString(data["path"]);
            double soal = Convert.ToDouble(data["l1"]) * 7 + Convert.ToDouble(data["l2"]) + Convert.ToDouble(data["f1"]);//总长度
            double scale = Convert.ToDouble(data["scale"]);//比例
            if (scale == 0)
            {
                if (soal < 42.2)
                {
                    scale = 5.0;
                }
                else if (soal < 52.75)
                {
                    scale = 4.0;
                }
                else if (soal < 70.3)
                {
                    scale = 3.0;
                }
                else if (soal < 105.5)
                {
                    scale = 2;
                }
                else if (soal < 140.6)
                {
                    scale = 1.5;
                }
                else if (soal < 211)
                {
                    scale = 1.0;
                }
                else if (soal < 281.3)
                {
                    scale = 0.75;
                }
                else
                {
                    scale = 0.5;
                }
            }//比例判断
            double l1 = Convert.ToDouble(data["l1"]) * scale;
            double l2 = Convert.ToDouble(data["l2"]) * scale;
            double f1 = Convert.ToDouble(data["f1"]) * scale;
            double lpcon = l2 + f1;//连接伸出长度
            double lb_1 = 3 * l1;//体长1
            double lb_2 = 3 * l1;//体长2
            double bd_1 = Convert.ToDouble(data["bd1"]) * scale;//体直径1
            double bd_2 = Convert.ToDouble(data["bd2"]) * scale;//体直径2
            double lpr = lpcon + lb_1 + lb_2;//伸出长度
            double oal = l1 + lpr;//总长度
            //法兰
            double r4 = Convert.ToDouble(data["r4"]) * scale;
            double bb2 = Convert.ToDouble(data["bb2"]) * pi / 180;
            double d10 = Convert.ToDouble(data["d10"]) * scale;
            double d12 = Convert.ToDouble(data["d12"]) * scale;
            //hsk
            double dcon = Convert.ToDouble(data["dcon"]) * scale;//法兰直径
            double f3 = Convert.ToDouble(data["f3"]) * scale;
            double f4 = Convert.ToDouble(data["f4"]) * scale;
            double d2 = Convert.ToDouble(data["d2"]) * scale;
            double r1 = Convert.ToDouble(data["r1"]) * scale;
            double bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
            string ccms1 = Convert.ToString(data["ccms1"]);
            double czc1 = Convert.ToDouble(data["czc1"]);
            string ccms2 = Convert.ToString(data["ccms2"]);
            double czc2 = Convert.ToDouble(data["czc2"]);

            double isframe = Convert.ToDouble(data["isframe"]);

            DimensionStyle dimensionStyle = fun.DimStyle(true);


            if (ccms1 == "hsk01")//机床侧
            {
                if (czc1 == 32)
                {
                    l1 = 16 * scale;
                    l2 = 3.2 * scale;
                    f1 = 20 * scale;
                    f3 = 16 * scale;
                    f4 = 2 * scale;
                    dcon = 32 * scale;
                    d2 = 24.007 * scale;
                    d10 = 26.5 * scale;
                    d12 = 4 * scale;
                    r1 = 0.6 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc1 == 40)
                {
                    l1 = 20 * scale;
                    l2 = 5 * scale;
                    f1 = 20 * scale;
                    f3 = 16 * scale;
                    f4 = 2 * scale;
                    dcon = 40 * scale;
                    d2 = 30.007 * scale;
                    d10 = 34.8 * scale;
                    d12 = 4 * scale;
                    r1 = 0.8 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc1 == 50)
                {
                    l1 = 25 * scale;
                    l2 = 5 * scale;
                    f1 = 26 * scale;
                    f3 = 18 * scale;
                    f4 = 3.75 * scale;
                    dcon = 50 * scale;
                    d2 = 38.009 * scale;
                    d10 = 43 * scale;
                    d12 = 7 * scale;
                    r1 = 1 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc1 == 63)
                {
                    l1 = 32 * scale;
                    l2 = 6.3 * scale;
                    f1 = 26 * scale;
                    f3 = 18 * scale;
                    f4 = 3.75 * scale;
                    dcon = 63 * scale;
                    d2 = 48.01 * scale;
                    d10 = 55 * scale;
                    d12 = 7 * scale;
                    r1 = 1.2 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc1 == 80)
                {
                    l1 = 40 * scale;
                    l2 = 8 * scale;
                    f1 = 26 * scale;
                    f3 = 18 * scale;
                    f4 = 3.75 * scale;
                    dcon = 80 * scale;
                    d2 = 60.012 * scale;
                    d10 = 70 * scale;
                    d12 = 7 * scale;
                    r1 = 1.6 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc1 == 100)
                {
                    l1 = 50 * scale;
                    l2 = 10 * scale;
                    f1 = 29 * scale;
                    f3 = 20 * scale;
                    f4 = 3.75 * scale;
                    dcon = 100 * scale;
                    d2 = 75.013 * scale;
                    d10 = 92 * scale;
                    d12 = 7 * scale;
                    r1 = 2 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc1 == 125)
                {
                    l1 = 63 * scale;
                    l2 = 12.5 * scale;
                    f1 = 29 * scale;
                    f3 = 20 * scale;
                    f4 = 3.75 * scale;
                    dcon = 125 * scale;
                    d2 = 95.016 * scale;
                    d10 = 117 * scale;
                    d12 = 7 * scale;
                    r1 = 2.5 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc1 == 160)
                {
                    l1 = 80 * scale;
                    l2 = 16 * scale;
                    f1 = 31 * scale;
                    f3 = 22 * scale;
                    f4 = 3.75 * scale;
                    dcon = 160 * scale;
                    d2 = 120.016 * scale;
                    d10 = 152 * scale;
                    d12 = 7 * scale;
                    r1 = 3.2 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
            }
            if (ccms2 == "hsk01")//机床侧
            {
                if (czc2 == 32)
                {
                    l1 = 16 * scale;
                    l2 = 3.2 * scale;
                    f1 = 20 * scale;
                    f3 = 16 * scale;
                    f4 = 2 * scale;
                    dcon = 32 * scale;
                    d2 = 24.007 * scale;
                    d10 = 26.5 * scale;
                    d12 = 4 * scale;
                    r1 = 0.6 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc2 == 40)
                {
                    l1 = 20 * scale;
                    l2 = 5 * scale;
                    f1 = 20 * scale;
                    f3 = 16 * scale;
                    f4 = 2 * scale;
                    dcon = 40 * scale;
                    d2 = 30.007 * scale;
                    d10 = 34.8 * scale;
                    d12 = 4 * scale;
                    r1 = 0.8 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc2 == 50)
                {
                    l1 = 25 * scale;
                    l2 = 5 * scale;
                    f1 = 26 * scale;
                    f3 = 18 * scale;
                    f4 = 3.75 * scale;
                    dcon = 50 * scale;
                    d2 = 38.009 * scale;
                    d10 = 43 * scale;
                    d12 = 7 * scale;
                    r1 = 1 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc2 == 63)
                {
                    l1 = 32 * scale;
                    l2 = 6.3 * scale;
                    f1 = 26 * scale;
                    f3 = 18 * scale;
                    f4 = 3.75 * scale;
                    dcon = 63 * scale;
                    d2 = 48.01 * scale;
                    d10 = 55 * scale;
                    d12 = 7 * scale;
                    r1 = 1.2 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc2 == 80)
                {
                    l1 = 40 * scale;
                    l2 = 8 * scale;
                    f1 = 26 * scale;
                    f3 = 18 * scale;
                    f4 = 3.75 * scale;
                    dcon = 80 * scale;
                    d2 = 60.012 * scale;
                    d10 = 70 * scale;
                    d12 = 7 * scale;
                    r1 = 1.6 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc2 == 100)
                {
                    l1 = 50 * scale;
                    l2 = 10 * scale;
                    f1 = 29 * scale;
                    f3 = 20 * scale;
                    f4 = 3.75 * scale;
                    dcon = 100 * scale;
                    d2 = 75.013 * scale;
                    d10 = 92 * scale;
                    d12 = 7 * scale;
                    r1 = 2 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc2 == 125)
                {
                    l1 = 63 * scale;
                    l2 = 12.5 * scale;
                    f1 = 29 * scale;
                    f3 = 20 * scale;
                    f4 = 3.75 * scale;
                    dcon = 125 * scale;
                    d2 = 95.016 * scale;
                    d10 = 117 * scale;
                    d12 = 7 * scale;
                    r1 = 2.5 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
                if (czc2 == 160)
                {
                    l1 = 80 * scale;
                    l2 = 16 * scale;
                    f1 = 31 * scale;
                    f3 = 22 * scale;
                    f4 = 3.75 * scale;
                    dcon = 160 * scale;
                    d2 = 120.016 * scale;
                    d10 = 152 * scale;
                    d12 = 7 * scale;
                    r1 = 3.2 * scale;
                    lpcon = l2 + f1;
                    bb1 = (2 + 52 / 60 + 5 / 3600) * pi / 180;
                    bb2 = 60 * pi / 180;
                    r4 = 1 * scale;
                }
            }
            //判断锥柄skg
            if (ccms1 == "hsk01")
            {
                //坐标
                Vector2 v2 = new Vector2(-l1 + (r1 - r1 * Math.Sin(bb1)), d2 / 2 - l1 * Math.Tan(bb1) + (r1 - r1 * Math.Sin(bb1)) * r1 * Math.Tan(bb1));//机床侧
                Vector2 v1 = new Vector2(-l1, v2.Y - r1 * Math.Cos(bb1));
                Vector2 v3 = new Vector2(0, d2 / 2);
                Vector2 v4 = new Vector2(l2, v3.Y);
                Vector2 v5 = new Vector2(v4.X, -v4.Y);
                Vector2 v6 = new Vector2(v3.X, -v3.Y);
                Vector2 v7 = new Vector2(v2.X, -v2.Y);
                Vector2 v8 = new Vector2(v1.X, -v1.Y);
                double l = Math.Sqrt((v2.X - v1.X) * (v2.X - v1.X) + (v2.Y - v1.Y) * (v2.Y - v1.Y));
                double h = r1 - (Math.Sqrt((r1 * r1) - l * l / 4));
                //线段
                LwPolyline Arc1 = new LwPolyline();
                Arc1.Vertexes.Add(new LwPolylineVertex(v2));
                Arc1.Vertexes.Add(new LwPolylineVertex(v1));
                Arc1.Vertexes[0].Bulge = 2 * h / l;
                fun.PolyFill(dxf, Arc1, 0.3, contour);
                Vector2[] Line1 = { v2, v3 };
                fun.drawBLine(dxf, Line1, 0.3, contour);
                Vector2[] Line2 = { v3, v4 };
                fun.drawBLine(dxf, Line2, 0.3, contour);
                Vector2[] Line3 = { v4, v5 };
                fun.drawBLine(dxf, Line3, 0.3, contour);
                Vector2[] Line4 = { v5, v6 };
                fun.drawBLine(dxf, Line4, 0.3, contour);
                Vector2[] Line5 = { v6, v7 };
                fun.drawBLine(dxf, Line5, 0.3, contour);
                LwPolyline Arc2 = new LwPolyline();
                Arc2.Vertexes.Add(new LwPolylineVertex(v8));
                Arc2.Vertexes.Add(new LwPolylineVertex(v7));
                Arc2.Vertexes[0].Bulge = 2 * h / l;
                fun.PolyFill(dxf, Arc2, 0.3, contour);
                Vector2[] Line6 = { v8, v1 };
                fun.drawBLine(dxf, Line6, 0.3, contour);
                Vector2[] Line7 = { v2, v7 };
                fun.drawBLine(dxf, Line7, 0.3, contour);
                Vector2[] Line8 = { v3, v6 };
                fun.drawBLine(dxf, Line8, 0.3, contour);

                //坐标
                Vector2 v9 = new Vector2(l2, dcon / 2 - 1);//法兰外侧
                Vector2 v10 = new Vector2(l2 + 1, dcon / 2);
                Vector2 v11 = new Vector2(f3 - f4 / 2 - (dcon / 2 - d10 / 2 - r4 / 2) * Math.Tan(bb2 / 2), v10.Y);
                Vector2 v12 = new Vector2(f3 - f4 / 2, d10 / 2 + r4 / 2);
                Vector2 v13 = new Vector2(v12.X + r4 / 2 / Math.Tan(bb2 / 2), d10 / 2);
                Vector2 v14 = new Vector2(f3 + f4 / 2 - r4 / 2 / Math.Tan(bb2 / 2), v13.Y);
                Vector2 v15 = new Vector2(f3 + f4 / 2, v12.Y);
                Vector2 v16 = new Vector2(v15.X + (dcon / 2 - d10 / 2 - r4 / 2) * Math.Tan(bb2 / 2), v11.Y);
                Vector2 v17 = new Vector2(lpcon - 1, v16.Y);
                Vector2 v18 = new Vector2(lpcon, v16.Y - 1);
                Vector2 v19 = new Vector2(v9.X, -v9.Y);
                Vector2 v20 = new Vector2(v10.X, -v10.Y);
                Vector2 v21 = new Vector2(v11.X, -v11.Y);
                Vector2 v22 = new Vector2(v12.X, -v12.Y);
                Vector2 v23 = new Vector2(v13.X, -v13.Y);
                Vector2 v24 = new Vector2(v14.X, -v14.Y);
                Vector2 v25 = new Vector2(v15.X, -v15.Y);
                Vector2 v26 = new Vector2(v16.X, -v16.Y);
                Vector2 v27 = new Vector2(v17.X, -v17.Y);
                Vector2 v28 = new Vector2(v18.X, -v18.Y);
                double ll = Math.Sqrt((v15.X - v14.X) * (v15.X - v14.X) + (v15.Y - v14.Y) * (v15.Y - v14.Y));
                double hh = r4 - (Math.Sqrt((r4 * r4) - ll * ll / 4));
                //线段
                Vector2[] Line19 = { v9, v10 };
                fun.drawBLine(dxf, Line19, 0.3, contour);
                Vector2[] Line20 = { v10, v11 };
                fun.drawBLine(dxf, Line20, 0.3, contour);
                Vector2[] Line21 = { v11, v12 };
                fun.drawBLine(dxf, Line21, 0.3, contour);
                LwPolyline Arc3 = new LwPolyline();
                Arc3.Vertexes.Add(new LwPolylineVertex(v12));
                Arc3.Vertexes.Add(new LwPolylineVertex(v13));
                Arc3.Vertexes[0].Bulge = 2 * hh / ll;
                fun.PolyFill(dxf, Arc3, 0.3, contour);
                Vector2[] Line22 = { v13, v14 };
                fun.drawBLine(dxf, Line22, 0.3, contour);
                LwPolyline Arc4 = new LwPolyline();
                Arc4.Vertexes.Add(new LwPolylineVertex(v14));
                Arc4.Vertexes.Add(new LwPolylineVertex(v15));
                Arc4.Vertexes[0].Bulge = 2 * hh / ll;
                fun.PolyFill(dxf, Arc4, 0.3, contour);
                Vector2[] Line23 = { v15, v16 };
                fun.drawBLine(dxf, Line23, 0.3, contour);
                Vector2[] Line24 = { v16, v17 };
                fun.drawBLine(dxf, Line24, 0.3, contour);
                Vector2[] Line25 = { v17, v18 };
                fun.drawBLine(dxf, Line25, 0.3, contour);
                Vector2[] Line26 = { v18, v28 };
                fun.drawBLine(dxf, Line26, 0.3, contour);
                Vector2[] Line27 = { v28, v27 };
                fun.drawBLine(dxf, Line27, 0.3, contour);
                Vector2[] Line28 = { v27, v26 };
                fun.drawBLine(dxf, Line28, 0.3, contour);
                Vector2[] Line29 = { v26, v25 };
                fun.drawBLine(dxf, Line29, 0.3, contour);
                LwPolyline Arc5 = new LwPolyline();
                Arc5.Vertexes.Add(new LwPolylineVertex(v25));
                Arc5.Vertexes.Add(new LwPolylineVertex(v24));
                Arc5.Vertexes[0].Bulge = 2 * hh / ll;
                fun.PolyFill(dxf, Arc5, 0.3, contour);
                Vector2[] Line30 = { v24, v23 };
                fun.drawBLine(dxf, Line30, 0.3, contour);
                LwPolyline Arc6 = new LwPolyline();
                Arc6.Vertexes.Add(new LwPolylineVertex(v23));
                Arc6.Vertexes.Add(new LwPolylineVertex(v22));
                Arc6.Vertexes[0].Bulge = 2 * hh / ll;
                fun.PolyFill(dxf, Arc6, 0.3, contour);
                Vector2[] Line31 = { v22, v21 };
                fun.drawBLine(dxf, Line31, 0.3, contour);
                Vector2[] Line32 = { v21, v20 };
                fun.drawBLine(dxf, Line32, 0.3, contour);
                Vector2[] Line33 = { v20, v19 };
                fun.drawBLine(dxf, Line33, 0.3, contour);
                Vector2[] Line34 = { v19, v9 };
                fun.drawBLine(dxf, Line34, 0.3, contour);
                Vector2[] Line35 = { v10, v20 };
                fun.drawBLine(dxf, Line35, 0.3, contour);
                Vector2[] Line36 = { v11, v21 };
                fun.drawBLine(dxf, Line36, 0.3, contour);
                Vector2[] Line37 = { v12, v22 };
                fun.drawBLine(dxf, Line37, 0.3, contour);
                Vector2[] Line38 = { v13, v23 };
                fun.drawBLine(dxf, Line38, 0.3, contour);
                Vector2[] Line39 = { v14, v24 };
                fun.drawBLine(dxf, Line39, 0.3, contour);
                Vector2[] Line40 = { v15, v25 };
                fun.drawBLine(dxf, Line40, 0.3, contour);
                Vector2[] Line41 = { v16, v26 };
                fun.drawBLine(dxf, Line41, 0.3, contour);
                Vector2[] Line42 = { v17, v27 };
                fun.drawBLine(dxf, Line42, 0.3, contour);
                //坐标
                Vector2 v29 = new Vector2(v18.X, bd_2 / 2);
                Vector2 v30 = new Vector2(v29.X + lb_2 - lb_2 / 5, bd_2 / 2);
                Vector2 v31 = new Vector2(v29.X + lb_2, bd_1 / 2);
                Vector2 v32 = new Vector2(lpcon + lb_2 + lb_1, bd_1 / 2);
                Vector2 v33 = new Vector2(v32.X, -v32.Y);
                Vector2 v34 = new Vector2(v31.X, -v31.Y);
                Vector2 v35 = new Vector2(v30.X, -v30.Y);
                Vector2 v36 = new Vector2(v29.X, -v29.Y);
                //线段
                Vector2[] Line43 = { v29, v30 };
                fun.drawBLine(dxf, Line43, 0.3, contour);
                Vector2[] Line44 = { v30, v31 };
                fun.drawBLine(dxf, Line44, 0.3, contour);
                Vector2[] Line45 = { v31, v32 };
                fun.drawBLine(dxf, Line45, 0.3, contour);
                Vector2[] Line46 = { v32, v33 };
                fun.drawBLine(dxf, Line46, 0.3, contour);
                Vector2[] Line47 = { v33, v34 };
                fun.drawBLine(dxf, Line47, 0.3, contour);
                Vector2[] Line48 = { v34, v35 };
                fun.drawBLine(dxf, Line48, 0.3, contour);
                Vector2[] Line49 = { v35, v36 };
                fun.drawBLine(dxf, Line49, 0.3, contour);
                Vector2[] Line50 = { v30, v35 };
                fun.drawBLine(dxf, Line50, 0.3, contour);
                Vector2[] Line51 = { v31, v34 };
                fun.drawBLine(dxf, Line51, 0.3, contour);

                //文本样式
                double offset = 10;
                //标注
                LinearDimension dim1 = new LinearDimension(new Line(v9, v18), offset, 0, dimensionStyle);
                dim1.SetDimensionLinePosition(new Vector2(v31.X,v31.Y+offset));
                dim1.UserText = "LPCON="+ Math.Round(lpcon / scale, 2);
                dxf.AddEntity(dim1);

                LinearDimension dim2 = new LinearDimension(new Line(v9, v19), 5 * offset, 90, dimensionStyle);
                dim2.UserText = "DCON="+ Math.Round(dcon / scale, 2);
                dxf.AddEntity(dim2);

                LinearDimension dim3 = new LinearDimension(new Line(v8, v33), 2 * offset + (v8.Y + v33.Y) / 2 - v34.Y, 180, dimensionStyle);
                dim3.UserText = "OAL="+ Math.Round(oal / scale, 2);
                dxf.AddEntity(dim3);

                LinearDimension dim4 = new LinearDimension(new Line(v19, v33), offset + (v19.Y + v33.Y) / 2 - v34.Y, 180, dimensionStyle);
                dim4.UserText = "LPR="+ Math.Round(lpr / scale, 2);
                dxf.AddEntity(dim4);

                LinearDimension dim6 = new LinearDimension(new Line(v18, v31), offset + v31.Y - (v18.Y + v31.Y) / 2, 0, dimensionStyle);
                dim6.UserText = "LB_2="+ Math.Round(lb_2 / scale, 2);
                dxf.AddEntity(dim6);

                LinearDimension dim7 = new LinearDimension(new Line(v31, v32), offset, 0, dimensionStyle);
                dim7.UserText = "LB_1="+ Math.Round(lb_1 / scale, 2);
                dxf.AddEntity(dim7);

                LinearDimension dim8 = new LinearDimension(new Line(v32, v33), offset, 270, dimensionStyle);
                dim8.UserText = "BD_1="+ Math.Round(bd_1 / scale, 2);
                dxf.AddEntity(dim8);

                LinearDimension dim9 = new LinearDimension(new Line(v30, v35), -offset, 270, dimensionStyle);
                dim9.UserText = "BD_2="+ Math.Round(bd_2 / scale, 2);
                dxf.AddEntity(dim9);
            }
            //工件侧
            if (ccms2 == "hsk01")
            {
                //坐标
                Vector2 v37 = new Vector2(lpcon + lb_2 + lb_1 - l1, d2 / 2 - l1 * Math.Tan(bb1) + (r1 - r1 * Math.Sin(bb1)) * r1 * Math.Tan(bb1));
                Vector2 v38 = new Vector2(lpcon + lb_2 + lb_1, d2 / 2);
                Vector2 v39 = new Vector2(v38.X, -v38.Y);
                Vector2 v40 = new Vector2(v37.X, -v37.Y);

                //线段
                Vector2[] Line16 = { v37, v38 };
                fun.drawPlinetype(dxf, Line16, 0.15, refin, Linetype.Dashed);
                Vector2[] Line17 = { v39, v40 };
                fun.drawPlinetype(dxf, Line17, 0.15, refin, Linetype.Dashed);
                Vector2[] Line18 = { v40, v37 };
                fun.drawPlinetype(dxf, Line18, 0.15, refin, Linetype.Dashed);

                //图框
                if (isframe == 1)
                {
                    Dictionary<string, Vector2> position = Frame.frameA3X(dxf, new Vector2(-l1 + oal / 2 - 210, dcon / 2 + 148.5 - dcon / 2));
                    fun.writetext(dxf, scale + ":1", position["比例"], 3.5, 0, 0.6, "C");
                }
            }

            fun.SetLayer(dxf); fun.SetByLayer(dxf);

            //文件格式
            dxf.DrawingVariables.AcadVer = DxfVersion.AutoCad2007;
            dxf.Save(path);
        }
    }
}